Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fused-effects/fused-effects-mwc-random
High-quality random numbers from a variety of distributions, as an effect.
https://github.com/fused-effects/fused-effects-mwc-random
Last synced: 17 days ago
JSON representation
High-quality random numbers from a variety of distributions, as an effect.
- Host: GitHub
- URL: https://github.com/fused-effects/fused-effects-mwc-random
- Owner: fused-effects
- License: bsd-3-clause
- Created: 2020-01-02T00:37:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-05T17:38:46.000Z (over 4 years ago)
- Last Synced: 2024-12-24T12:30:14.063Z (19 days ago)
- Language: Haskell
- Size: 36.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# fused-effects-mwc-random
[![Hackage](https://img.shields.io/hackage/v/fused-effects-mwc-random.svg?logo=haskell)](https://hackage.haskell.org/package/fused-effects-mwc-random)
[![BSD3 license](https://img.shields.io/badge/license-BSD3-blue.svg)](LICENSE)High-quality uniformly-distributed pseudorandom number generation as an effect.
This library provides a `Random` effect that piggybacks atop the `mwc-random` package, which produces high-quality random numbers in efficient time. A carrier type (`Control.Carrier.Random.Lifted`) encapsulates generator state and provides a convenient API to invoke system random number generation or pass a predefined seed. The `mwc-random` package is finely tuned; as such, this package should be an industrial-strength source of random numbers, suitable for tight loops.
Please note that the [MWC-256](https://en.wikipedia.org/wiki/Multiply-with-carry_pseudorandom_number_generator) algorithm that underlies `mwc-random` is *not* cryptographically secure and should not be used for such purposes. Crypto code should use [`cryptonite`](https://hackage.haskell.org/package/cryptonite), as I'm sure you already know.
For more advanced users, there exists also a module (`Control.Carrier.Random.Instances`) that provides the orphan instances required to use most `fused-effect` stacks with the `PrimMonad` machinery that powers `mwc-random`. This module is most useful when porting monad transformer stacks that already use the `mwc-random` API, or if you need to drop into the native `mwc-random` API.