Algorthim/Logic to Generate 6 Digit Unique Random Numbers

How do I ensure that the min number is never below 100000?
Add 100,000 to it. Why can't the number be below 100,000?

I would use a LFSR.
http://en.wikipedia.org/wiki/Linear_feedback_shift_register
a 20 bit cycle, 2^20 numbers, would provode 6 digits of random numbers that never repeat within the cycle. You would need to check when the number is greater or equal to 1000000 and do another iteration until a number came up below 1000000.

Edit, the numbers will not really be random. If someone is clever enough to figure out what a LFSR is and its bit length they can predict the next number. No truly random generator will guarantee that the same number will not be used twice in a row.

I have another random number generator that will generate 2^64-1 binary patterns. It passes the tests that mathematicians have for testing randomness.
 
Last edited:

Similar Topics

I got my PanelView Plus 7 working with a Micrologix 1500. How would I connect my laptop to the PanelView to view the ladder logic while operating...
Replies
6
Views
161
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
13
Views
244
Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
174
Good morning fellow sea captains and wizards, I am being asked to do the above and obtain 4 values from each slave, I know about the MRX and MWX...
Replies
32
Views
849
I have a machine which is undergoing upgradation. As part of the process two SEW drives are being replaced., existing Gen B with new Gen C. The...
Replies
3
Views
204
Back
Top Bottom