Converting a function from C to Delphi
Posted on 1998-12-01
I'm curently in the process of writing a BO packet detector but I've been unable to get the BO "random" number generator to convert from the C code to delphi.
The C code (as in the source for the BO client for unix) is as follows:
int mrand ( void)
return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);
my translation goes like this:
result:=(((x * 214013) + 2531011) shr 16) and $7fff;
the problem is, this doesn't always return the same results as the C version. I've tried everything I can think of.. can anyone help?