Skip to content
/ librng Public
forked from bhickey/librng

Public Domain random number generators for C++

License

Notifications You must be signed in to change notification settings

blblack/librng

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#libRNG

libRNG is a public domain collection of pseudo-random number generators for C++. It provides several efficient and statistically robust generators.

Usage

  • Build using make.
  • Link against individual objects, or use build/librng.so.

Notes

split() returns a new generator, seeded from this. There is no guarantee that the generators will be independent in any robust sense, but the implementations of split() make a good faith effort to do something reasonable.

seed_with(uint32_t) constructs a linear-congrugential generator (LCG), which is then used as the argument to seed(RNG*). LCGs have some bad properties: correlation between sequential outputs, and distribution of outputs in a few hyperplanes. This will be replaced with a 32-bit Xorshift generator, or a complementary multiply with carry generator.

get_geometric() relies on __builtin_ctz. A version of this function should be provided for users of non-GNU compilers.

Acknowledgements

The generators presented here are largely adapted from the public domain C sources in David Jones's manuscript Good
Practice in (Pseudo) Random Number Generation for Bioinformatics Applications
(pdf).

The interface is inspired by Haskell's System.Random.

About

Public Domain random number generators for C++

Resources

License

Stars

Watchers

Forks

Packages

No packages published