Peter Nachtwey
Member
Add 100,000 to it. Why can't the number be below 100,000?How do I ensure that the min number is never below 100000?
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: