20 #ifndef RNGSTREAM_H |
20 #ifndef RNGSTREAM_H |
21 #define RNGSTREAM_H |
21 #define RNGSTREAM_H |
22 #include <string> |
22 #include <string> |
23 #include <stdint.h> |
23 #include <stdint.h> |
24 |
24 |
|
25 /** |
|
26 * \file |
|
27 * \ingroup rngimpl |
|
28 * Declaration of class RngStream. |
|
29 */ |
|
30 |
25 namespace ns3 { |
31 namespace ns3 { |
26 |
32 |
27 /** |
33 /** |
28 * \ingroup randomvariable |
34 * \ingroup randomvariable |
|
35 * \defgroup rngimpl RNG Implementation. |
|
36 */ |
|
37 |
|
38 /** |
|
39 * \ingroup rngimpl |
29 * |
40 * |
30 * \brief Combined Multiple-Recursive Generator MRG32k3a |
41 * \brief Combined Multiple-Recursive Generator MRG32k3a |
31 * |
42 * |
32 * This class is the combined multiple-recursive random number |
43 * This class is the combined multiple-recursive random number |
33 * generator called MRG32k3a. The ns3::RandomVariableBase class |
44 * generator called MRG32k3a. The ns3::RandomVariableBase class |
36 * http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf |
47 * http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf |
37 */ |
48 */ |
38 class RngStream |
49 class RngStream |
39 { |
50 { |
40 public: |
51 public: |
|
52 /** |
|
53 * Construct from explicit seed, stream and substream values. |
|
54 * |
|
55 * \param seed The starting seed. |
|
56 * \param stream The stream number. |
|
57 * \param substream The sub-stream number. |
|
58 */ |
41 RngStream (uint32_t seed, uint64_t stream, uint64_t substream); |
59 RngStream (uint32_t seed, uint64_t stream, uint64_t substream); |
42 RngStream (const RngStream&); |
60 /** |
|
61 * Copy constructor. |
|
62 * |
|
63 * \param r The RngStream to copy. |
|
64 */ |
|
65 RngStream (const RngStream & r); |
43 /** |
66 /** |
44 * Generate the next random number for this stream. |
67 * Generate the next random number for this stream. |
45 * Uniformly distributed between 0 and 1. |
68 * Uniformly distributed between 0 and 1. |
|
69 * |
|
70 * \returns The next random. |
46 */ |
71 */ |
47 double RandU01 (void); |
72 double RandU01 (void); |
48 |
73 |
49 private: |
74 private: |
|
75 /** |
|
76 * Advance \p state of the RNG by leaps and bounds. |
|
77 * |
|
78 * \param nth The stream or substream index. |
|
79 * \param by The log2 base of \p nth. |
|
80 * \param state The state vector to advance. |
|
81 */ |
50 void AdvanceNthBy (uint64_t nth, int by, double state[6]); |
82 void AdvanceNthBy (uint64_t nth, int by, double state[6]); |
51 |
83 |
|
84 /** The RNG state vector. */ |
52 double m_currentState[6]; |
85 double m_currentState[6]; |
53 }; |
86 }; |
54 |
87 |
55 } // namespace ns3 |
88 } // namespace ns3 |
56 |
89 |