A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
rng-stream.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2001 Pierre L'Ecuyer (lecuyer@iro.umontreal.ca)
3
//
4
// SPDX-License-Identifier: GPL-2.0-only
5
//
6
// Modified for ns-3 by: Rajib Bhattacharjea<raj.b@gatech.edu>
7
8
#ifndef RNGSTREAM_H
9
#define RNGSTREAM_H
10
#include <stdint.h>
11
#include <string>
12
13
/**
14
* \file
15
* \ingroup rngimpl
16
* ns3::RngStream declaration.
17
*/
18
19
namespace
ns3
20
{
21
22
/**
23
* \ingroup randomvariable
24
* \defgroup rngimpl RNG Implementation
25
*/
26
27
/**
28
* \ingroup rngimpl
29
*
30
* \brief Combined Multiple-Recursive Generator MRG32k3a
31
*
32
* This class is the combined multiple-recursive random number
33
* generator called MRG32k3a. The ns3::RandomVariableBase class
34
* holds a static instance of this class. The details of this
35
* class are explained in:
36
* http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
37
*/
38
class
RngStream
39
{
40
public
:
41
/**
42
* Construct from explicit seed, stream and substream values.
43
*
44
* \param [in] seed The starting seed.
45
* \param [in] stream The stream number.
46
* \param [in] substream The sub-stream number.
47
*/
48
RngStream
(
uint32_t
seed, uint64_t stream, uint64_t substream);
49
/**
50
* Copy constructor.
51
*
52
* \param [in] r The RngStream to copy.
53
*/
54
RngStream
(
const
RngStream
& r);
55
/**
56
* Generate the next random number for this stream.
57
* Uniformly distributed between 0 and 1.
58
*
59
* \returns The next random.
60
*/
61
double
RandU01
();
62
63
private
:
64
/**
65
* Advance \pname{state} of the RNG by leaps and bounds.
66
*
67
* \param [in] nth The stream or substream index.
68
* \param [in] by The log2 base of \pname{nth}.
69
* \param [in] state The state vector to advance.
70
*/
71
void
AdvanceNthBy
(uint64_t nth,
int
by,
double
state[6]);
72
73
/** The RNG state vector. */
74
double
m_currentState
[6];
75
};
76
77
}
// namespace ns3
78
79
#endif
ns3::RngStream
Combined Multiple-Recursive Generator MRG32k3a.
Definition
rng-stream.h:39
ns3::RngStream::RngStream
RngStream(uint32_t seed, uint64_t stream, uint64_t substream)
Construct from explicit seed, stream and substream values.
Definition
rng-stream.cc:367
ns3::RngStream::m_currentState
double m_currentState[6]
The RNG state vector.
Definition
rng-stream.h:74
ns3::RngStream::AdvanceNthBy
void AdvanceNthBy(uint64_t nth, int by, double state[6])
Advance state of the RNG by leaps and bounds.
Definition
rng-stream.cc:390
ns3::RngStream::RandU01
double RandU01()
Generate the next random number for this stream.
Definition
rng-stream.cc:330
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
rng-stream.h
Generated on Wed Oct 9 2024 01:03:23 for ns-3 by
1.11.0