You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > TRandomGenerator Class
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
TRandomGenerator Class

Random generator.

Dew_Math_TRandomGenerator
Syntax
C#
Visual Basic
public class TRandomGenerator : System.MarshalByRefObject, IDisposable;

RndGenerators.cs

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.
var rnd : TRandomGenerator; IntVec : TVecInt; begin if Seed = -1 then Seed := aRound(Random*High(Cardinal)); rnd := TRandomGenerator.Create; IntVec := TVecInt.Create; try IntVec.Size(Results.Length, prInt32); rnd.StreamCount := 1; rnd.Init(rgMRG32k3a,Seed); rnd.Stream[0].RandomBinomial(IntVec,an,p); Results.Copy(IntVec); finally rnd.Free; IntVec.Free; end end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!