A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
Random Variables

ns-3 random numbers are provided via instances of ns3::RandomVariableStream. More...

Collaboration diagram for Random Variables:

Topics

 Core example: Empirical random variables use.
 RNG Implementation

Files

file  many-uniform-random-variables-one-get-value-call-test-suite.cc
 Test for many uniform random variable streams.
file  one-uniform-random-variable-many-get-value-calls-test-suite.cc
 Test for one uniform random variable stream.
file  random-variable-stream-helper.cc
 ns3::RandomVariableStreamHelper implementation.
file  random-variable-stream-helper.h
 ns3::RandomVariableStreamHelper declaration.
file  random-variable-stream.cc
 ns3::RandomVariableStream and related implementations
file  random-variable-stream.h
 ns3::RandomVariableStream declaration, and related classes.
file  rng-seed-manager.cc
 ns3::RngSeedManager implementation.
file  rng-seed-manager.h
 ns3::RngSeedManager declaration.
file  sample-random-variable-stream.cc
 Example program illustrating use of ns3::RandomVariableStream.
file  sample-random-variable.cc
 Example program illustrating use of ns3::RandomVariable.
file  sample-rng-plot.py
 Demonstrate use of ns-3 as a random number generator integrated with plotting tools.
file  shuffle.h
 Function to shuffle elements in a given range.

Classes

class  ns3::BernoulliRandomVariable
 The Bernoulli distribution Random Number Generator (RNG). More...
class  ns3::BinomialRandomVariable
 The binomial distribution Random Number Generator (RNG). More...
class  ns3::ConstantRandomVariable
 The Random Number Generator (RNG) that returns a constant. More...
class  ns3::DeterministicRandomVariable
 The Random Number Generator (RNG) that returns a predetermined sequence. More...
class  ns3::EmpiricalRandomVariable
 The Random Number Generator (RNG) that has a specified empirical distribution. More...
class  ns3::ErlangRandomVariable
 The Erlang distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::ExponentialRandomVariable
 The exponential distribution Random Number Generator (RNG). More...
class  ns3::GammaRandomVariable
 The gamma distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::LaplacianRandomVariable
 The laplacian distribution Random Number Generator (RNG). More...
class  ns3::LargestExtremeValueRandomVariable
 The Largest Extreme Value distribution Random Number Generator (RNG). More...
class  ns3::LogNormalRandomVariable
 The log-normal distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::NormalRandomVariable
 The normal (Gaussian) distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::ParetoRandomVariable
 The Pareto distribution Random Number Generator (RNG). More...
class  ns3::RandomVariableStream
 The basic uniform Random Number Generator (RNG). More...
class  ns3::RngSeedManager
 Manage the seed number and run number of the underlying random number generator, and automatic assignment of stream numbers. More...
class  ns3::SequentialRandomVariable
 The Random Number Generator (RNG) that returns a pattern of sequential values. More...
class  ns3::TriangularRandomVariable
 The triangular distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::UniformRandomVariable
 The uniform distribution Random Number Generator (RNG). More...
class  ns3::WeibullRandomVariable
 The Weibull distribution Random Number Generator (RNG) which allows stream numbers to be set deterministically. More...
class  ns3::ZetaRandomVariable
 The zeta distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...
class  ns3::ZipfRandomVariable
 The Zipf distribution Random Number Generator (RNG) that allows stream numbers to be set deterministically. More...

Detailed Description

ns-3 random numbers are provided via instances of ns3::RandomVariableStream.

  • By default, ns-3 simulations use a fixed seed; if there is any randomness in the simulation, each run of the program will yield identical results unless the seed and/or run number is changed.
  • In ns-3.3 and earlier, ns-3 simulations used a random seed by default; this marks a change in policy starting with ns-3.4.
  • In ns-3.14 and earlier, ns-3 simulations used a different wrapper class called ns3::RandomVariable. This implementation is documented above under Legacy Random Variables. As of ns-3.15, this class has been replaced by ns3::RandomVariableStream; the underlying pseudo-random number generator has not changed.
  • To obtain randomness across multiple simulation runs, you must either set the seed differently or set the run number differently. To set a seed, call ns3::RngSeedManager::SetSeed() at the beginning of the program; to set a run number with the same seed, call ns3::RngSeedManager::SetRun() at the beginning of the program.
  • Each RandomVariableStream used in ns-3 has a virtual random number generator associated with it; all random variables use either a fixed or random seed based on the use of the global seed.
  • If you intend to perform multiple runs of the same scenario, with different random numbers, please be sure to read the manual section on how to perform independent replications.