[Haskell-cafe] why is Random in System?

Bryan O'Sullivan bos at serpentine.com
Wed Aug 17 20:39:12 CEST 2011

On Wed, Aug 17, 2011 at 11:10 AM, Ryan Newton <rrnewton at gmail.com> wrote:

> The problem with Mersenne twister is that it doesn't split well.  The main
> reason for crypto prng in this package would not be to advertise to people
> that "System.Random can be used for security-related apps" *but to make
> splitting reasonably safe*.

The more fundamental problem is that splitting is neither well understood
nor generally safe, and as such it should not be in the basic Random class.
A more sensible API would have a Random class that lacks a split operation,
and a SplittableRandom class that permits it, as you mention later in your
message. Most current PRNGs could then be instances of Random, but not

And I think we need splitting, especially as more Haskell programs become
> parallel.

I do not agree here, I'm afraid.

By the way, my mwc-random package is at least as fast as mersenne-twister,
has smaller state, and is pure Haskell.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110817/93f528ec/attachment.htm>

More information about the Haskell-Cafe mailing list