Use this class to generate streams of random numbers. To achieve independence between two series of random numbers there are three options: 1. create several instances of this class and initialize each with a different seed. (and maybe a different random generator). 2. create a single instance of this class and use leapfroging. 3. create a single instance of this class and use block splitting.
Examples
cpp
#include "MtxExpr.h"
#include "MtxVecInt.h"
#include "RndGenerators.h"
#include "Units.Math387.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
void Example()
{
int Seed = -1;
Vector Results(1000);
int an = 20;
double p = 0.3;
TRandomGenerator* rnd;
TVecInt* IntVec;
if (Seed == -1) Seed = RoundToInt(Random()*2147483647.0);
rnd = new TRandomGenerator();
IntVec = new TVecInt();
IntVec->Size(Results.Length, TIntPrecision::prInt32);
rnd->StreamCount = 1;
rnd->Init(TBasicRandomGenerator::rgMRG32K3A, Seed);
rnd->Streams(0)->RandomBinomial(IntVec, an, p);
Results.Copy(IntVec);
delete rnd;
delete IntVec;
}