forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Lib rand
huonw edited this page Apr 28, 2013
·
31 revisions
Generating random numbers, and sampling from random distributions.
- Proposed editor: your name
- Date proposed: date of proposal
- Link: link to email
- Standard: standard - link to docs - ...
- Standard: standard - link to docs - ...
- Technique: Generating random bits (i.e
u32
oru64
) - ISAAC/ISAAC-64 RNG- http://burtleburtle.net/bob/rand/isaacafa.html
- ISAAC is the main RNG used in rust at the moment
- Technique: Testing quality of random numbers - Very important! Extremely hard to tell if random numbers are "random enough" (a bug in an implementation, or a bad algorithm, can produce numbers that look random but aren't random enough for many purposes). - Overview wikipedia article - Diehard tests (e.g. dieharder) - TestU01 including "Small crush", "Crush" and "Big crush" - tests written by the creator of ISAAC - Add a new make target "check-rngs" with a testsuite?
- Technique: sampling from distributions - Inverse transform sampling (fully general) - Ziggurat algorithm (distributions with decreasing density functions) - Box-Muller transform and Marsaglia polar method (normal distribution, both are almost certainly inferior to the ziggurat algorithm)
- Language: C++ - http://www.cplusplus.com/reference/random/
- Language: Python - http://docs.python.org/3.3/library/random.html
- Language: R (statistical language, so much broader random number support than necessary) - http://stat.ethz.ch/R-manual/R-patched/library/base/html/Random.html - http://stat.ethz.ch/R-manual/R-patched/library/stats/html/Distributions.html
- Language: D - http://dlang.org/phobos/std_random.html (no support for sampling from distributions other than uniform, but many RNGs)
- Language: Go - http://golang.org/pkg/math/rand/
- Library: GSL - https://www.gnu.org/software/gsl/manual/html_node/Random-Number-Generation.html - https://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html
- Pull request: link to bug
- note
- note
- note