RandomGen, mkStdGen

Ian Lynagh igloo at earth.li
Fri Jan 19 12:07:04 EST 2007


On Fri, Jan 05, 2007 at 10:21:21AM +0000, Frederik Eaton wrote:
> 
> Thus, I suggest a new member of class RandomGen:
> 
> mkRandomGen :: [Int] -> g
> 
> It is similar to mkStdGen, but it takes a list of Int's so that users
> who want to save more bits of state across conversions can do so. 

It's not clear to me that this really makes sense in general.

It's hard to say without knowing what you're doing, but I think you'd be
better off just calling mkMyRandomGen, perhaps even taking a tuple
rather than a list so you know you have the right number of bits.

Incidentally, you sound like you want Int32 rather than Int; Int is only
guaranteed to be 29 bits, and today may be either 32 or 64 bits
depending on what platform you are on.


Thanks
Ian



More information about the Libraries mailing list