AC-Random: A pure Haskell PRNG.
This is a psuedo-random number generator (PRNG). It is designed to
replace the standard Haskell '98 PRNG from the random
package. It
has the following properties:
Nicer API than
random
. (Supports all sizes ofInt
andWord
, for example.)Much faster than
random
. (In my tests, roughly 14x faster.)Comparable quality to
random
. (Both libraries pass the "Die Harder" suite of statistical randomness tests. In other words, neither has any overly obvious pattern to the "random" numbers it produces. Both libraries pass Die Harder with similar scores.)100% Haskell '98 code. No compiler-specific features. No external dependencies. Builds everywhere.
Pure functions and simple ADTs. No mutable state, no
IO
monad. Simple API.
The actual algorithm is a lag-4 Multiply With Carry (MWC)
generator, using 32-bit arithmetic. (Should be fast on 32-bit and
64-bit platforms.) If my algebra is correct, its period should be
roughly 1.46 * 10^48. (By constrast, random
claims to have a
period of only 2.30 * 10^18.)
Note that this algorithm, by itself, is not cryptographically secure.
Changes:
Initial release.
Downloads
- AC-Random-0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1 |
---|---|
Dependencies | base (>=4 && <5) [details] |
License | BSD-3-Clause |
Author | Andrew Coppin |
Maintainer | MathematicalOrchid@hotmail.com |
Category | Random |
Uploaded | by AndrewCoppin at 2011-08-25T09:34:35Z |
Distributions | NixOS:0.1 |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 1997 total (6 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |