Random number generation is typically a two step process: first generate a uniformly distributed value, then transform that value to have the desired distribution. The former is the hard part, but also the part more likely to have been done for you in a library. The latter is relatively easy in principle, though some distributions are hard to (efficiently) sample from.

Here are some posts on testing a uniform RNG.

Here’s a book chapter I wrote on testing the transformation of a uniform RNG into some other distribution.

A few posts on manipulating a random number generator.

- Manipulating a random number generator
- Reverse engineering the seed of an LCG
- Predicting when an RNG will output a given value

And finally, a post on a cryptographically secure random number generator.

When I was a grad student, the bible for this was Luc Devroye’s marvelous book _Non-Uniform Random Variate Generation_. Has that now been supplanted by some more up-to-date tome?