[Haskell-cafe] ANN: tf-random 0.1 (splittable pseudorandom number generator)

Michał Pałka michal.palka at chalmers.se
Thu Sep 19 13:04:19 CEST 2013


Dear all,

I am happy to announce the release of tf-random 0.1. tf-random is a
high-quality splittable pseudorandom number generator intended to
address the random number quality problems of the standard Haskell
StdGen generator.

tf-random uses a cryptographic hash function under the hood to generate
pseudorandom numbers, which is based on the ThreeFish block cipher. The
design of the generator is explained in the paper 'Splittable
Pseudorandom Number Generators Using Cryptographic Hashing' by Claessen,
Pałka, which will be presented on the upcoming Haskell Symposium.

The performance of tf-random was found to be about 8% slower than StdGen
on typical QuickCheck properties, which make heavy use of splitting, but
up to 2x faster in linear generation on a x86-64 processor.

The package is available from hackage at:

http://hackage.haskell.org/package/tf-random

The code has not yet been thoroughly tested, so expect bugs. For
example, it has never been tried on a big-endian architecture, and I
would appreciate if somebody could check if the results returned by it
are the same (with a given random seed) as on x86.

In addition to the generator, the package also contains alternative
versions of the RandomGen and Random classes. The most notable
difference is that method 'next' from RandomGen returns a Word32 drawn
uniformly from its the full range. The reason for this change is that I
found it impossible to write efficient Random instances that are
parametrized over the range of the generator (genRange). The instances
currently defined in the random package make an (illegitimate)
assumption that the range of StdGen is used, for that matter.

I hope that this release will spark a discussion about the future of the
standard PRNG and the RandomGen API in Haskell.

Best regards,
Michał

PS. Please copy me when replying as I am not on the list.





More information about the Haskell-Cafe mailing list