2014-06-01 17:55:23 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
|
|
|
|
* It is copyright by its individual contributors, as recorded in the
|
|
|
|
* project's Git history. See COPYING.txt at the top level for license
|
|
|
|
* terms and a link to the Git history.
|
|
|
|
*/
|
2006-03-20 17:12:09 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Descent random number stuff...
|
|
|
|
* rand has different ranges on different machines...
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2013-01-03 15:35:37 +00:00
|
|
|
#include "maths.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#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
|