in reply to Generating random 6 digit numbers
3^1 = 3 = 3 (mod 7) 3^2 = 9 = 2 (mod 7) 3^3 = 27 = 6 (mod 7) 3^4 = 81 = 4 (mod 7) 3^5 = 243 = 5 (mod 7) 3^6 = 729 = 1 (mod 7)The outcome is a shuffle of the numbers (1..6). In your case, you could choose 999983 as p, wasting 17 possible numbers, or 1000003, which forces you to repeat the generation when the outcome is greater than 999999. In both cases, a number only depends on the previous one, which makes generation very easy and storage minimum. If you depend on an attacker not being able to guess the sequence, this method is far too weak.
|
|---|