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
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
#ifndef RANDOM_STREAM_H
21
#define RANDOM_STREAM_H
22
23
#include <stdint.h>
24
#include <list>
25
#include "ns3/random-variable-stream.h"
26
27
namespace
ns3 {
28
33
class
RandomStream
34
{
35
public
:
36
virtual
~RandomStream
();
44
virtual
uint32_t
GetNext
(uint32_t min, uint32_t max) = 0;
45
54
virtual
int64_t
AssignStreams
(int64_t stream) = 0;
55
};
56
57
class
RealRandomStream
:
public
RandomStream
58
{
59
public
:
60
RealRandomStream
();
61
virtual
uint32_t
GetNext
(uint32_t min, uint32_t max);
62
71
virtual
int64_t
AssignStreams
(int64_t stream);
72
73
private
:
75
Ptr<UniformRandomVariable>
m_stream
;
76
};
77
78
class
TestRandomStream
:
public
RandomStream
79
{
80
public
:
86
void
AddNext
(uint32_t v);
87
virtual
uint32_t
GetNext
(uint32_t min, uint32_t max);
88
97
virtual
int64_t
AssignStreams
(int64_t stream);
98
99
private
:
100
std::list<uint32_t>
m_nexts
;
101
};
102
103
}
// namespace ns3
104
105
#endif
/* RANDOM_STREAM_H */
ns3::RandomStream::~RandomStream
virtual ~RandomStream()
Definition:
random-stream.cc:27
ns3::Ptr< UniformRandomVariable >
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:57
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:75
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
ns3::TestRandomStream
Definition:
random-stream.h:78
ns3::RandomStream
A simple wrapper around RngStream to make testing of the code easier.
Definition:
random-stream.h:33
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::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:100
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 Sat Apr 19 2014 14:07:11 for ns-3 by
1.8.6