Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Code snippets about random numbers.
0.
Get a random double from a normal distribution,
GetRandomNormal
1.
Get a random double from zero to one,
GetRandomUniform
2.
Get a random integer, std::rand
3.
GetRandomNormal, get a random double from a
normal distribution
4.
GetRandomUniform, get a random double from zero
to one
6.
random_shuffle, shuffle a std::vector to a random
order
7.
Randomize on timer, RandomizeTimer
8.
RandomizeTimer, randomize on timer
9.
Set
seed using timer: see Randomize on timer
10.
Shuffle a std::vector to a random order,
std::random_shuffle
11.
std::rand, get a random integer
12.
std::random_shuffle, shuffle a std::vector to a
random order