Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andeplane/randomnumbergenerator
A random number generator wrapping class. It uses c++11 to generate random numbers in a thread safe way.
https://github.com/andeplane/randomnumbergenerator
Last synced: 1 day ago
JSON representation
A random number generator wrapping class. It uses c++11 to generate random numbers in a thread safe way.
- Host: GitHub
- URL: https://github.com/andeplane/randomnumbergenerator
- Owner: andeplane
- Created: 2016-01-25T07:22:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-26T07:31:16.000Z (almost 9 years ago)
- Last Synced: 2024-05-01T21:39:19.464Z (8 months ago)
- Language: C++
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RandomNumberGenerator
A random number generator wrapping class. It uses c++11 to generate random numbers in a thread safe way.c++11 random number generation supports many different generators which are thread safe. This static class wraps these commands into a simpler usage.
# Example
```c++
int seed = 12345;
Random::seed(seed);
cout << "Here are some random numbers based on seed " << seed << ":" << endl;
cout << "Random int: " << Random::nextInt(0,10) << endl;
cout << "Random double: " << Random::nextDouble() << endl;
cout << "Random float: " << Random::nextFloat() << endl;
cout << "Random long: " << Random::nextLong(0,10) << endl << endl;Random::randomSeed();
cout << "Choosing random seed based on clock." << endl;
cout << "Random int: " << Random::nextInt(0,10) << endl;
cout << "Random double: " << Random::nextDouble() << endl;
cout << "Random float: " << Random::nextFloat() << endl;
cout << "Random long: " << Random::nextLong(0,10) << endl << endl;
```