Added the random number generation functions.