Unfortunatley, I have to exactly clone the behaviour of delphi's prng for my use case.

One aproach was following suggestion of putting the random function into a dll.

But after some research it turned out that delphi is using a linear congruential generator (see

http://en.wikipedia.org/wiki/Linear_congruential_generator). The equation for generating the number sequence is: x_{n+1}=(a*x_n + c) mod m

Further investigation depicted delphi is using the following values for the constants:

a=134775813

c=1

m=2^32

After a while of fiddling around I ended up with this piece of code, which is exactly reproducung the delphi's random number squence.

`function hr_random2(const pi_Max: Integer):Integer;`

var

Temp: Longint;

begin

Temp := 134775813 * i_hr_RandomSeed + 1;

i_hr_RandomSeed := Temp; //

Result := (UInt64(Cardinal(pi_Max)) * UInt64(Cardinal(Temp))) shr 32;

end;

Thanks to all who pointed me into the right direction.