Imagination is more important than knowledge
Albert Einstein
mt_rand is an easy to use C++ class that encapsulates a Mersenne Twister Random Number generator and a series of useful functions. The Merrsenne Twister algorithm was invented by Makoto Matsumoto and Takuji Nishimura only a few years age, and is certainly the best random number generator around (far better than the std::rand() you may be using now...)
More than 99% of the run time of all of my computers is used to search for ever larger Mersenne Primes (see my primes page), and the question I get asked most is if there is any practical use for these crazily large primes - now there is, and you are looking at it.
Almost all vendors implementations of rand() in the C library (and indeed, most all languages...) use whats known as a linear congruential generator:
Given a non-negative integer, P_{n}, P_{n+1} is equal to (aP_{n} + c) mod m
(Where the values of a, c, and m are carefully chosen. Press et. al. ('Numerical recipies in C') recomend m=714,025 a=1,366 and c=150,889)
This algorithm is easy to implement, reasonbly fast, and extremely well known - but it has a number of serious limitations that affect some common applications: Where lots of random numbers are needed (simulations, genetic algorithms, simulated annealing), or high quality random numbers are needed (Monte Carlo simulation).
mt_rand provides an efficient implementation of a 32-bit Mersenne-Twister peusdo-random number generator, as well as a number of utility functions, all wrapped in a modern C++ class.