You can implement a reasonable split if you can fast-forward the generator.
There's no known method to fast-forward the MT, but other generators
like MRG32k3a can handle it.

  -- Lennart

On Thu, Feb 26, 2009 at 12:08 PM, Bertram Felgenhauer
<bertram.felgenha...@googlemail.com> wrote:
> hask...@kudling.de wrote:
>> Do you think it would be feasable to replace the GHC implementation
>> of System.Random with something like System.Random.Mersenne?
>
> There's a problem with using the Mersenne Twister: System.Random's
> interface has a split method:
>
> class RandomGen g where
>   split    :: g -> (g, g)
>
> The Mersenne Twister is good at producing a single stream of random
> numbers - in fact it works by generating a whole block of random
> numbers in one go, then consuming the block, and only then generating
> the next block.
>
> I have no idea how to implement a split method that produces
> independent streams. Even if I did, using split a lot would likely
> spoil the performance benefit of the generator.
>
> (System.Random.Mersenne.Pure64 provides a RandomGen instance for
> PureMT, but it cheats:)
>
>   split = error "System.Random.Mersenne.Pure: unable to split the mersenne 
> twister"
>
> Bertram
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to