home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_02_08
/
2n08056a
< prev
next >
Wrap
Text File
|
1991-06-10
|
384b
|
22 lines
/*
Random number generator used by the standard
library for the Microsoft C compiler version 5.1.
*/
static unsigned long seed;
void srand(int iseed)
{
seed = (unsigned long) iseed << 16;
}
int rand()
{
/*
** incidental mod of 2^32 by ignoring
** overflow during multiply and add
*/
seed = seed * 214013L + 2531011L;
return ((seed >> 16) & 0x7FFF);
}