{$R-,S-,B-}

UNIT RANDNUM;

INTERFACE

Const

Rnd_M = 65521;

Rnd_C = 42000;

Rnd_A = 58417;

RndXn: Word = 16;

Procedure MyRandomizer;

Function MyRandomGen: Real;

IMPLEMENTATION

Procedure MyRandomizer;

Var

Rnd: Word Absolute $40:$6C; {***I think this is the problem***}

Begin

RndXn:=Rnd

End;

Function MyRandomGen: Real;

VAR

Tot,Frac: Real;

Begin

Tot:=(Rnd_A*RndXn+Rnd_C)/R

Frac:=(Tot-Trunc(Tot));

RndXn:=Trunc(Frac*Rnd_M);

MyRandomGen:=Frac;

End;

End.

Mod. version...

{$R-,S-,B-}

UNIT RANDNUM;

INTERFACE

Const

Rnd_M = 65521;

Rnd_C = 42000;

Rnd_A = 58417;

RndXn: Word = 16;

Procedure MyRandomizer;

Function MyRandomGen: Real;

IMPLEMENTATION

USES

CRT;

Procedure MyRandomizer;

Var

Rnd: Word; (*Absolute $40:$6C; {***Eliminate this***}*)

HH,MM,SS,S100: Word;

Begin

GetTime(HH,MM,SS,S100);

RndXn:=HH+MM+SS+S100);

End;

Function MyRandomGen: Real;

VAR

Tot,Frac: Real;

Begin

Tot:=(Rnd_A*RndXn+Rnd_C)/R

Frac:=(Tot-Trunc(Tot));

RndXn:=Trunc(Frac*Rnd_M);

MyRandomGen:=Frac;

End;

End.