21#include <spot/misc/common.hh>
37 SPOT_API
void srand(
unsigned int seed);
43 SPOT_API
int rrand(
int min,
int max);
77 template<
double (*gen)()>
83 :
n_(n),
m_(n * p),
s_(sqrt(n * p * (1 - p)))
93 int x = round(gen() *
s_ +
m_);
111 template<
class iterator_type>
114 auto d = std::distance(first, last);
117 for (--last; first < last; ++first, --d)
120 std::swap(*first, *(first + i));
Compute pseudo-random integer value between 0 and n included, following a binomial distribution with ...
Definition random.hh:79
const int n_
Upper bound.
Definition random.hh:103
const double s_
Standard deviation.
Definition random.hh:105
const double m_
Mean.
Definition random.hh:104
barand(int n, double p)
Build a binomial random generator.
Definition random.hh:82
int rand() const
Return a random value.
Definition random.hh:89
double drand()
Compute a pseudo-random double value between 0.0 and 1.0 (1.0 excluded).
void srand(unsigned int seed)
Reset the seed of the pseudo-random number generator.
int rrand(int min, int max)
Compute a pseudo-random integer value between min and max included.
double nrand()
Compute a pseudo-random double value following a standard normal distribution. (Odeh & Evans)
void mrandom_shuffle(iterator_type &&first, iterator_type &&last)
Shuffle the container using mrand function above. This allows to get rid off shuffle or random_shuffl...
Definition random.hh:112
int mrand(int max)
Compute a pseudo-random integer value between 0 and max-1 included.
Definition automata.hh:26