A Discrete-Event Network Simulator
API
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 
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 
62 {
63 public:
65  virtual uint32_t GetNext (uint32_t min, uint32_t max);
66 
76  virtual int64_t AssignStreams (int64_t stream);
77 
78 
79 private:
82 };
83 
84 
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 */
virtual ~RandomStream()
#define min(a, b)
Definition: 80211b.c:44
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< UniformRandomVariable > m_stream
Provides uniform random variables.
Definition: random-stream.h:81
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
#define max(a, b)
Definition: 80211b.c:45
A simple wrapper around RngStream to make testing of the code easier.
Definition: random-stream.h:34
virtual uint32_t GetNext(uint32_t min, uint32_t max)
Get integer between min and max (including min and max).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddNext(uint32_t v)
Add the given value to the list.
std::list< uint32_t > m_nexts
virtual uint32_t GetNext(uint32_t min, uint32_t max)
Get integer between min and max (including min and max).
virtual uint32_t GetNext(uint32_t min, uint32_t max)=0
Get integer between min and max (including min and max).