Random number generators

The libraries in this subsection are as follows:

  • MonadRandom: Simple monadic interface for supplying random numbers. Uses System.Random. It's rather slow and not very secure.
  • mwc-random: Very fast pseudo-random number generation. Probably not cryptographically secure.
  • random-fu: Good support for sampling a wide range of different distributions. Good quality but not terribly slow either.
  • mersenne-random: Pseudo-random numbers using a Mersenne Twister. Probably fastest RNG for Haskell when SIMD is supported.

Random numbers have multiple applications, from simulations to cryptography. Random number generators come with different trade-offs that suit different applications. Others are very fast and not really that random, while ...

Get Haskell High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.