31 #include "attribute-helper.h" |
31 #include "attribute-helper.h" |
32 #include <stdint.h> |
32 #include <stdint.h> |
33 |
33 |
34 namespace ns3 { |
34 namespace ns3 { |
35 |
35 |
|
36 /** |
|
37 * \ingroup core |
|
38 * \defgroup randomvariable Random Variables |
|
39 * |
|
40 * \brief ns-3 random numbers are provided via instances of |
|
41 * ns3::RandomVariableStream. |
|
42 * |
|
43 * - By default, ns-3 simulations use a fixed seed; if there is any |
|
44 * randomness in the simulation, each run of the program will yield |
|
45 * identical results unless the seed and/or run number is changed. |
|
46 * - In ns-3.3 and earlier, ns-3 simulations used a random seed by default; |
|
47 * this marks a change in policy starting with ns-3.4. |
|
48 * - In ns-3.14 and earlier, ns-3 simulations used a different wrapper |
|
49 * class called ns3::RandomVariable. This implementation is documented |
|
50 * above under Legacy Random Variables. As of ns-3.15, this class has |
|
51 * been replaced by ns3::RandomVariableStream; the underlying |
|
52 * pseudo-random number generator has not changed. |
|
53 * - To obtain randomness across multiple simulation runs, you must |
|
54 * either set the seed differently or set the run number differently. |
|
55 * To set a seed, call ns3::RngSeedManager::SetSeed() at the beginning |
|
56 * of the program; to set a run number with the same seed, call |
|
57 * ns3::RngSeedManager::SetRun() at the beginning of the program. |
|
58 * - Each RandomVariableStream used in ns-3 has a virtual random number |
|
59 * generator associated with it; all random variables use either |
|
60 * a fixed or random seed based on the use of the global seed. |
|
61 * - If you intend to perform multiple runs of the same scenario, |
|
62 * with different random numbers, please be sure to read the manual |
|
63 * section on how to perform independent replications. |
|
64 */ |
|
65 |
36 class RngStream; |
66 class RngStream; |
37 |
67 |
38 /** |
68 /** |
39 * \ingroup randomvariable |
69 * \ingroup randomvariable |
40 * \brief The Random Number Generator (RNG) that allows stream numbers to be set deterministically. |
70 * \brief The Random Number Generator (RNG) that allows stream numbers to be set deterministically. |
1980 /// The lower bound on values that can be returned by this RNG stream. |
2010 /// The lower bound on values that can be returned by this RNG stream. |
1981 double m_min; |
2011 double m_min; |
1982 |
2012 |
1983 /// The upper bound on values that can be returned by this RNG stream. |
2013 /// The upper bound on values that can be returned by this RNG stream. |
1984 double m_max; |
2014 double m_max; |
|
2015 |
|
2016 /// It's easier to work with the mode internally instead of the |
|
2017 /// mean. They are related by the simple: mean = (min+max+mode)/3. |
|
2018 double m_mode; |
1985 }; |
2019 }; |
1986 |
2020 |
1987 /** |
2021 /** |
1988 * \ingroup randomvariable |
2022 * \ingroup randomvariable |
1989 * \brief The Zipf distribution Random Number Generator (RNG) that |
2023 * \brief The Zipf distribution Random Number Generator (RNG) that |