How to get random Long-integer under D1 ---------------------------------------- Random(Range:word) function under D1 returns random integer with the uniform distribution on the interval [0..Range-1]. Sometimes, however, range larger than 65535 (maximum value for Word type) is required. The following function allows to specify range in the interval [0..2147483647]. function LongD1Random(Range: Longint): Longint; var dummy: word; c: comp; x: array[0..1] of longint absolute c; begin x[1] := 0; { Clear higher DWORD of c } X[0] := RandSeed; { We already have pseudorandom longint - RandSeed. Move it into low DWORD of c } Dummy := random(1); { New pseudorandom value is assigned to RandSeed during this call } c := c*Range; { Scaling x[0] to [0..Range-1] interval requires multiplication into 64 bit integer ... } Result:= x[1]; { .. and subsequent shr 32 operation. This is where Comp type comes handy } end;