Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'doc' into 'master'
[simgrid.git] / include / xbt / random.hpp
1 /* Copyright (c) 2019-2020. The SimGrid Team. All rights reserved.               */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_XBT_RANDOM_HPP
7 #define SIMGRID_XBT_RANDOM_HPP
8
9 namespace simgrid {
10 namespace xbt {
11 namespace random {
12
13 /**
14  * @brief Tells xbt/random to use the ad-hoc distribution implementation.
15  */
16 void set_implem_xbt();
17
18 /**
19  * @brief Tells xbt/random to use the standard library distribution implementation.
20  */
21 void set_implem_std();
22
23 /**
24  * @brief Sets the seed of the Mersenne-Twister RNG
25  */
26 void set_mersenne_seed(int);
27
28 /**
29  * @brief Draws an integer number uniformly in range [min, max] (min and max included)
30  *
31  * @param min Minimum value
32  * @param max Maximum value
33  */
34 int uniform_int(int min, int max);
35
36 /**
37  * @brief Draws a real number uniformly in range [min, max) (min included, and max excluded)
38  *
39  * @param min Minimum value
40  * @param max Maximum value
41  */
42 double uniform_real(double min, double max);
43
44 /**
45  * @brief Draws a real number according to the given exponential distribution
46  *
47  * @param lambda Parameter of the exponential law
48  */
49 double exponential(double lambda);
50
51 /**
52  * @brief Draws a real number according to the given normal distribution
53  *
54  * @param mean Mean of the normal distribution
55  * @param sd Standard deviation of the normal distribution
56  */
57 double normal(double mean, double sd);
58 } // namespace random
59 } // namespace xbt
60 } // namespace simgrid
61
62 #endif