25 #include <spot/misc/common.hh> 41 SPOT_API
void srand(
unsigned int seed);
47 SPOT_API
int rrand(
int min,
int max);
53 SPOT_API
int mrand(
int max);
59 SPOT_API
double drand();
67 SPOT_API
double nrand();
87 template<
double (*gen)()>
92 : n_(n), m_(n * p), s_(sqrt(n * p * (1 - p)))
101 int x = round(gen() * s_ + m_);
120 SPOT_API
int prand(
double p);
125 template<
class iterator_type>
128 auto d = std::distance(first, last);
131 for (--last; first < last; ++first, --d)
134 std::swap(*first, *(first + i));
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:126
int rrand(int min, int max)
Compute a pseudo-random integer value between min and max included.
double drand()
Compute a pseudo-random double value between 0.0 and 1.0 (1.0 excluded).
double nrand()
Compute a pseudo-random double value following a standard normal distribution. (Odeh & Evans) ...
void srand(unsigned int seed)
Reset the seed of the pseudo-random number generator.
int mrand(int max)
Compute a pseudo-random integer value between 0 and max-1 included.
double bmrand()
Compute a pseudo-random double value following a standard normal distribution. (Box-Muller) ...
Compute pseudo-random integer value between 0 and n included, following a binomial distribution with ...
Definition: random.hh:88
int prand(double p)
Return a pseudo-random positive integer value following a Poisson distribution with parameter p...