dxx-rebirth/maths/rand.c
Bradley Bell 9bd1ba7c47 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
2001-01-19 03:30:16 +00:00

28 lines
439 B
C

// Descent random number stuff...
// rand has different ranges on different machines...
#include <conf.h>
#include <stdlib.h>
#ifdef NO_WATCOM_RAND
void d_srand(unsigned int seed)
{
srand(seed);
}
int d_rand()
{
return rand()&0x7fff;
}
#else
static unsigned int d_rand_seed;
int d_rand() {
return ((d_rand_seed = d_rand_seed * 0x41c64e6d + 0x3039) >> 16) & 0x7fff;
}
void d_srand(unsigned int seed) {
d_rand_seed = seed;
}
#endif