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
random-stream.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef RANDOM_STREAM_H
22
#define RANDOM_STREAM_H
23
24
#include <stdint.h>
25
#include <list>
26
#include "ns3/random-variable-stream.h"
27
28
namespace
ns3
{
29
34
class
RandomStream
35
{
36
public
:
37
virtual
~RandomStream
();
46
virtual
uint32_t
GetNext
(uint32_t
min
, uint32_t
max
) = 0;
47
57
virtual
int64_t
AssignStreams
(int64_t stream) = 0;
58
};
59
60
61
class
RealRandomStream
:
public
RandomStream
62
{
63
public
:
64
RealRandomStream
();
65
virtual
uint32_t
GetNext
(uint32_t
min
, uint32_t
max
);
66
76
virtual
int64_t
AssignStreams
(int64_t stream);
77
78
79
private
:
81
Ptr<UniformRandomVariable>
m_stream
;
82
};
83
84
85
class
TestRandomStream
:
public
RandomStream
86
{
87
public
:
93
void
AddNext
(uint32_t v);
94
virtual
uint32_t
GetNext
(uint32_t
min
, uint32_t
max
);
95
105
virtual
int64_t
AssignStreams
(int64_t stream);
106
107
108
private
:
109
std::list<uint32_t>
m_nexts
;
110
};
111
112
}
//namespace ns3
113
114
#endif
/* RANDOM_STREAM_H */
ns3::RandomStream::~RandomStream
virtual ~RandomStream()
Definition:
random-stream.cc:27
ns3::Ptr< UniformRandomVariable >
min
#define min(a, b)
Definition:
80211b.c:44
ns3::RandomStream::AssignStreams
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
ns3::RealRandomStream
Definition:
random-stream.h:61
ns3::RealRandomStream::AssignStreams
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition:
random-stream.cc:44
ns3::RealRandomStream::m_stream
Ptr< UniformRandomVariable > m_stream
Provides uniform random variables.
Definition:
random-stream.h:81
ns3::TestRandomStream::AssignStreams
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition:
random-stream.cc:66
max
#define max(a, b)
Definition:
80211b.c:45
ns3::TestRandomStream
Definition:
random-stream.h:85
ns3::RandomStream
A simple wrapper around RngStream to make testing of the code easier.
Definition:
random-stream.h:34
ns3::RealRandomStream::RealRandomStream
RealRandomStream()
Definition:
random-stream.cc:32
ns3::RealRandomStream::GetNext
virtual uint32_t GetNext(uint32_t min, uint32_t max)
Get integer between min and max (including min and max).
Definition:
random-stream.cc:38
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TestRandomStream::AddNext
void AddNext(uint32_t v)
Add the given value to the list.
Definition:
random-stream.cc:51
ns3::TestRandomStream::m_nexts
std::list< uint32_t > m_nexts
Definition:
random-stream.h:109
ns3::TestRandomStream::GetNext
virtual uint32_t GetNext(uint32_t min, uint32_t max)
Get integer between min and max (including min and max).
Definition:
random-stream.cc:57
ns3::RandomStream::GetNext
virtual uint32_t GetNext(uint32_t min, uint32_t max)=0
Get integer between min and max (including min and max).
src
wifi
model
random-stream.h
Generated on Thu Mar 24 2016 00:46:58 for ns-3 by
1.8.9.1