Suppose you're working on a virtual board game and want to simulate the roll of a die. The first programming book I ever owned suggested the following:
int result = rand() % 6;
If you've spent any time reading about random numbers in computer science, you've
probably heard that this is a bad idea. The reason that's usually given is that
rand()
(just like the standard RNGs of many other languages, such as