Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Documenting xbt/random a little bit
[simgrid.git] / include / xbt / random.hpp
1 /* Copyright (c) 2019. 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  * @brief Tells xbt/random to use the standard library distribution implementation.
19  */
20 void set_implem_std();
21 /**
22  * @brief Sets the seed of the Mersenne-Twister RNG
23  */
24 void set_mersenne_seed(int);
25
26 /**
27  * @brief Draws an integer number uniformly between min and max included
28  *
29  * @param min Minimum value
30  * @param max Maximum value
31  */
32 int uniform_int(int min, int max);
33 /**
34  * @brief Draws a real number uniformly between min and max included
35  *
36  * @param min Minimum value
37  * @param max Maximum value
38  */
39 double uniform_real(double min, double max);
40 /**
41  * @brief Draws a real number according to the given exponential distribution
42  *
43  * @param lambda Parameter of the exponential law
44  */
45 double exponential(double lambda);
46 /**
47  * @brief Draws a real number according to the given normal distribution
48  *
49  * @param mean Mean of the normal distribution
50  * @param sd Standard deviation of the normal distribution
51  */
52 double normal(double mean, double sd);
53 } // namespace random
54 } // namespace xbt
55 } // namespace simgrid
56
57 #endif