News for hackers. Stuff that matters.
Re:How Do Computers Generate Random Numbers? by teddyh on Monday September 14, 2020 @07:42AM (#24469005)
To make a dice roll uniform, wouldn’t it be easier to do randomNumber % 8 and only use it if it is from 0 to 5, and discard and re-roll otherwise?

(Since we can reasonably assume that randomNumber is a binary number, and thus would be balanced over 8 values instead of 6.)

Re:How Do Computers Generate Random Numbers? by lsc36 on Monday September 14, 2020 @08:02AM (#24469107)
That depends on the modulus being divisible by 8, which is not always the case. A common example is modulus = 2^31 - 1 [0] which is prime.

[0] https://en.wikipedia.org/wiki/Linear_congruential_generator#...