Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linki/rng
An easy to use random number generator with distributions
https://github.com/linki/rng
Last synced: about 2 months ago
JSON representation
An easy to use random number generator with distributions
- Host: GitHub
- URL: https://github.com/linki/rng
- Owner: linki
- Created: 2011-07-04T20:32:46.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-07-08T12:49:56.000Z (over 13 years ago)
- Last Synced: 2024-10-12T18:53:49.892Z (3 months ago)
- Language: C++
- Homepage:
- Size: 97.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h3. An easy to use random number generator with distributions
i couldn't find a single easy to use random numbers generator in c, that lets you define min/max boundaries, number of distinct values and a distribution. so i started writing one based on boost's distribution classes.
goals:
- simple api
- distributions
- correctparameters:
- num values
- num unique values
- rangeTODO:
- distributions (normal distribution atm)
- iterators
- perf
// #values, #distinct values, range min, range max
RNG rng(100, 50, 1, 100);rng.generate();
for(size_t i = 0; i < rng.generated_values.size(); ++i)
{
printf("%d\n", rng.generated_values[i]);
}Example Output of bin/main
.
. some values
.
#values: 100
#distinct values: 50
min value: 1
max value: 100