(no title)
lsc36 | 5 years ago
2. The dice roll example is not uniform distribution, I think this is a common pitfall when generating random integers of a range. `randomNumber % 6` results in a slight bias towards 0 and 1, since 2^31 % 6 == 2, there are more numbers in the range [0, 2^31-1] that map to 0 and 1 than those that map to 2...5. To make it uniform, for example, you should always discard if `randomNumber < 2` and regenerate another number for use.
ficklepickle|5 years ago
https://en.wikipedia.org/wiki/Benford%27s_law
chriselles|5 years ago
On first pass, Benford’s Law looks a lot like Zipf’s Law.
What differentiates Benford’s Law from Zipf’s Law?
blauditore|5 years ago
lsc36|5 years ago
teddyh|5 years ago
(Since we can reasonably assume that randomNumber is a binary number, and thus would be balanced over 8 values instead of 6.)
lsc36|5 years ago
[0] https://en.wikipedia.org/wiki/Linear_congruential_generator#...
atg_abhishek|5 years ago