A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uniform-random-bit-generator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19#ifndef UNIFORM_RANDOM_BIT_GENERATOR_H
20#define UNIFORM_RANDOM_BIT_GENERATOR_H
21
23
24#include <limits>
25
26namespace ns3
27{
28
36{
37 public:
40 {
41 }
42
47 {
48 return m_rv;
49 }
50
53
57 static constexpr result_type min()
58 {
59 return 0;
60 }
61
65 static constexpr result_type max()
66 {
67 return std::numeric_limits<result_type>::max();
68 }
69
74 {
75 return m_rv->GetInteger(min(), max());
76 }
77
78 private:
80};
81
82} // namespace ns3
83
84#endif /* UNIFORM_RANDOM_BIT_GENERATOR_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Wraps a UniformRandomVariable into a class that meets the requirements of a UniformRandomBitGenerator...
Ptr< UniformRandomVariable > m_rv
ns-3 style uniform random variable
static constexpr result_type max()
static constexpr result_type min()
Ptr< UniformRandomVariable > GetRv() const
The uniform distribution Random Number Generator (RNG).
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value drawn from the distribution.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition: object.h:579
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RandomVariableStream declaration, and related classes.