A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
rng-seed-manager.cc
Go to the documentation of this file.
1
#include "
rng-seed-manager.h
"
2
#include "
global-value.h
"
3
#include "
attribute-helper.h
"
4
#include "
integer.h
"
5
#include "
config.h
"
6
7
namespace
ns3 {
8
9
static
uint64_t
g_nextStreamIndex
= 0;
10
static
ns3::GlobalValue
g_rngSeed
(
"RngSeed"
,
11
"The global seed of all rng streams"
,
12
ns3::IntegerValue
(1),
13
ns3::MakeIntegerChecker<uint32_t> ());
14
static
ns3::GlobalValue
g_rngRun
(
"RngRun"
,
15
"The run number used to modify the global seed"
,
16
ns3::IntegerValue
(1),
17
ns3::MakeIntegerChecker<int64_t> ());
18
19
20
uint32_t
RngSeedManager::GetSeed
(
void
)
21
{
22
IntegerValue
seedValue;
23
g_rngSeed
.
GetValue
(seedValue);
24
return
seedValue.
Get
();
25
}
26
void
27
RngSeedManager::SetSeed
(uint32_t seed)
28
{
29
Config::SetGlobal
(
"RngSeed"
,
IntegerValue
(seed));
30
}
31
32
void
RngSeedManager::SetRun
(uint64_t run)
33
{
34
Config::SetGlobal
(
"RngRun"
,
IntegerValue
(run));
35
}
36
37
uint64_t
RngSeedManager::GetRun
()
38
{
39
IntegerValue
value;
40
g_rngRun
.
GetValue
(value);
41
int
run = value.
Get
();
42
return
run;
43
}
44
45
uint64_t
RngSeedManager::GetNextStreamIndex
(
void
)
46
{
47
uint64_t next =
g_nextStreamIndex
;
48
g_nextStreamIndex
++;
49
return
next;
50
}
51
52
}
// namespace ns3
src
core
model
rng-seed-manager.cc
Generated on Tue Oct 9 2012 16:45:35 for ns-3 by
1.8.1.2