A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rng-stream.cc File Reference

ns3::RngStream and MRG32k3a implementations. More...

#include "rng-stream.h"
#include "fatal-error.h"
#include "log.h"
#include <cstdlib>
#include <iostream>
+ Include dependency graph for rng-stream.cc:

Go to the source code of this file.

Classes

struct  MRG32k3a::Precalculated
 The transition matrices of the two MRG components (in matrix form), raised to all powers of 2 from 1 to 191. More...
 

Namespaces

namespace  MRG32k3a
 Namespace for MRG32k3a implementation details.
 
namespace  ns3
 Every class exported by the ns3 library is enclosed in the ns3 namespace.
 

Typedefs

typedef double MRG32k3a::Matrix[3][3]
 Type for 3x3 matrix of doubles.
 

Functions

void MRG32k3a::MatMatModM (const Matrix A, const Matrix B, Matrix C, double m)
 Compute the matrix C = A*B MOD m.
 
void MRG32k3a::MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n)
 Compute the matrix B = (A^n Mod m); works even if A = B.
 
void MRG32k3a::MatTwoPowModM (const Matrix src, Matrix dst, double m, int32_t e)
 Compute the matrix B = (A^(2^e) Mod m); works also if A = B.
 
void MRG32k3a::MatVecModM (const Matrix A, const double s[3], double v[3], double m)
 Compute the vector v = A*s MOD m.
 
double MRG32k3a::MultModM (double a, double s, double c, double m)
 Return (a*s + c) MOD m; a, s, c and m must be < 2^35.
 
Precalculated MRG32k3a::PowerOfTwoConstants ()
 Compute the transition matrices of the two MRG components raised to all powers of 2 from 1 to 191.
 
void MRG32k3a::PowerOfTwoMatrix (int n, Matrix a1p, Matrix a2p)
 Get the transition matrices raised to a power of 2.
 

Variables

const double MRG32k3a::a12 = 1403580.0
 First component multiplier of n - 2 value.
 
const double MRG32k3a::a13n = 810728.0
 First component multiplier of n - 3 value.
 
const Matrix MRG32k3a::A1p0
 First component transition matrix.
 
const double MRG32k3a::a21 = 527612.0
 Second component multiplier of n - 1 value.
 
const double MRG32k3a::a23n = 1370589.0
 Second component multiplier of n - 3 value.
 
const Matrix MRG32k3a::A2p0
 Second component transition matrix.
 
const double MRG32k3a::m1 = 4294967087.0
 First component modulus, 232 - 209.
 
const double MRG32k3a::m2 = 4294944443.0
 Second component modulus, 232 - 22853.
 
const double MRG32k3a::norm = 1.0 / (m1 + 1.0)
 Normalization to obtain randoms on [0,1).
 
const double MRG32k3a::two17 = 131072.0
 Decomposition factor for computing a*s in less than 53 bits, 217
 
const double MRG32k3a::two53 = 9007199254740992.0
 IEEE-754 floating point precision, 253
 

Detailed Description

ns3::RngStream and MRG32k3a implementations.

Definition in file rng-stream.cc.