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

Any one give solution for this fault. We are using AB Gaurd logix controller(5573s), resent days we are facing major fault in controller...
Replies
0
Views
3
Hello, I am going over some old code from days gone by. I would like the expert to confirm my findings to see if I got it correct. 1. B64:22/3...
Replies
7
Views
485
Hello, I´m having a problem trying to program in Ladder. An output should be trigged by two possible contacts. Take a look on the printscreen...
Replies
5
Views
188
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
211
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
309
Back
Top Bottom