Re:Evolution of Random Number Generators
by ascar on Sunday May 02, 2021 @11:05AM
(#27015903)
If you want a simple pseudo random sequence of N that just looks random (pseudocode):
This will jump wildly across your sequence and visit all elements (as k and N are chosen coprime). No need to store a full array. Is it statistically random? Of course not, e.g. you will never see two values close to each other right after another.
[ Parent
| on HN ]
Re:Evolution of Random Number Generators
by anderskaseorg on Sunday May 02, 2021 @12:47PM
(#27016662)
Your algorithm fails to choose k and N coprime for about 19% of N, such as N = 6, 10, 14, 15, 25, 27, 35, 36, 45, 54, 55, 65, 66, 75, 84, 85, 90, 93, 95 ….