Robert Feldt wrote: > Hi, > > Its good news that Ruby 1.7.x and later uses the Mersenne Twister for > rand. However, I feel we should have "taken it all the way" and introduced > a class for RNG's for which MersenneTwister is subclass and rand/srand > are really calls to an instance of a MersenneTwister instance. > > I'd like to know any reasons not to go down that route. The added > complexity would be minimal since the mt algorithm is already in the > interpreter. > > The main benefits imho would be: > > * Multiple different rng streams can be used independently from each other > * Persistence of rng streams by marshalling MT objects > * Conceptually nicer, more oo This has been on my wish list for a long time. I've been using an "objectified" version of the Numerical Recipes generators, but those are of poorer quality and are require a license. The only disadvantage (for my use at least) is that MT has much larger state than NR, so you want to think twice about using large numbers of them.