Class TEZRandomGenerator (unit EZDSLRnd)

Inherits from

TObject

Constructors


constructor Create;

--------} (**** function GetNextRandomWord(aTable : PrgTable) : Word; begin with aTable^ do begin inc(tEntries[tToOfs], tEntries[tFrmOfs]); Result := word(tEntries[tToOfs]); if (tToOfs = 0) then begin tToOfs := pred(TableEntries); dec(tFrmOfs); end else begin dec(tToOfs); if (tFrmOfs = 0) then tFrmOfs := pred(TableEntries) else dec(tFrmOfs); end; end; end; ****) {====================================================================} {===TEZRandomGenerator===============================================


Functions

procedure AcquireAccess;

-Destroy the generator

--------


destructor Destroy;

-Create the generator

--------


function Random : double;

-Reseed the generator, if aSeed is zero the generator reseeds from the system clock

--------


function RandomByte : byte;

-Return a random number in the range: 0.

function RandomDWord : DWORD;

-Return a random longint in the range: 0 <= R < 2,147,483,648

--------


function RandomFloatLimit(aUpperLimit : double) : double;

-Return a random integer in the range: aLowerLimit <= R < aUpperLimit} { NOTE: no check is made to see whether aUpperLimit > aLowerLimit

--------


function RandomFloatRange(aLowerLimit, aUpperLimit : double) : double;

-Return a random double in the range: 0.

function RandomIntLimit(aUpperLimit : integer) : integer;

-Return a random dword in the range: 0 <= R < 4,294,967,296

--------


function RandomIntRange(aLowerLimit, aUpperLimit : integer) : integer;

-Return a random integer in the range: 0 <= R < aUpperLimit} { NOTE: no check is made to see whether aUpperLimit > 0

--------


function RandomLong : longint;

-Return a random word in the range: 0 <= R < 65536

--------


function RandomWord : word;

-Return a random byte in the range: 0 <= R < 256

--------


procedure ReleaseAccess;

-Lock the generator in a multithreaded process

--------


procedure SetSeed(const aSeed : longint);

-Unlock the generator in a multithreaded process

--------


Properties

Events

Variables

rgList : pointer;


rgResLock : TezResourceLock;



Constructors


constructor Create;

--------} (**** function GetNextRandomWord(aTable : PrgTable) : Word; begin with aTable^ do begin inc(tEntries[tToOfs], tEntries[tFrmOfs]); Result := word(tEntries[tToOfs]); if (tToOfs = 0) then begin tToOfs := pred(TableEntries); dec(tFrmOfs); end else begin dec(tToOfs); if (tFrmOfs = 0) then tFrmOfs := pred(TableEntries) else dec(tFrmOfs); end; end; end; ****) {====================================================================} {===TEZRandomGenerator===============================================


Functions


procedure AcquireAccess;

-Destroy the generator

--------


destructor Destroy;

-Create the generator

--------


function Random : double;

-Reseed the generator, if aSeed is zero the generator reseeds from the system clock

--------


function RandomByte : byte;

-Return a random number in the range: 0.0 <= R < 1.0

--------


function RandomDWord : DWORD;

-Return a random longint in the range: 0 <= R < 2,147,483,648

--------


function RandomFloatLimit(aUpperLimit : double) : double;

-Return a random integer in the range: aLowerLimit <= R < aUpperLimit} { NOTE: no check is made to see whether aUpperLimit > aLowerLimit

--------


function RandomFloatRange(aLowerLimit, aUpperLimit : double) : double;

-Return a random double in the range: 0.0 <= R < aUpperLimit} { NOTE: no check is made to see whether aUpperLimit > 0

--------


function RandomIntLimit(aUpperLimit : integer) : integer;

-Return a random dword in the range: 0 <= R < 4,294,967,296

--------


function RandomIntRange(aLowerLimit, aUpperLimit : integer) : integer;

-Return a random integer in the range: 0 <= R < aUpperLimit} { NOTE: no check is made to see whether aUpperLimit > 0

--------


function RandomLong : longint;

-Return a random word in the range: 0 <= R < 65536

--------


function RandomWord : word;

-Return a random byte in the range: 0 <= R < 256

--------


procedure ReleaseAccess;

-Lock the generator in a multithreaded process

--------


procedure SetSeed(const aSeed : longint);

-Unlock the generator in a multithreaded process

--------


Properties


Events


Variables


rgList : pointer;


rgResLock : TezResourceLock;