[Haskell-cafe] [ANN] random-stream package
Manlio Perillo
manlio_perillo at libero.it
Thu Mar 19 10:54:13 EDT 2009
Gökhan San ha scritto:
> Manlio Perillo <manlio_perillo at libero.it> writes:
>
>> The stream generator implements tha RandomGen interface.
>
> This is really cool, though I think 'split' is a must. Maybe all
> instances could share the same stream in the background, then it
> wouldn't cause resource issues.
>
I have thought about this, but is it safe?
I feared that this would break referential transparency.
> Also, IMHO mkStream should produce an IO Stream (like getStdGen), as
> current implementation isn't referentially transparent; let the library
> user decide whether to use unsafePerformIO.
>
The basic idea is that there is this system wide random number
generator, that is always available.
That's the reason why mkIOStream is hidden.
>> 3) I have tested the package on Debian Linux Etch, using GHC 6.8.2.
>
> Tested with Gentoo Linux on a 64-bit machine using GHC 6.10.1. On my
> system, it is less than 2 times slower than StdGen.
>
Thanks for the report.
I have tested against the pure mersenne twister, on my 32 bit system,
and it seems to have the same performances.
I should check against StdGen, too.
Manlio
More information about the Haskell-Cafe
mailing list