home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
prog_c
/
zc.lzh
/
ZC
/
ZCSRC.LZH
/
IOLib
/
misc
/
rand.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1989-06-15
|
328 b
|
19 lines
/*
* In environments where the operating system doesn't provide
* a random number generator, the following code may be useful.
*/
static unsigned long _seed = 1;
int rand()
{
_seed = (_seed * 1103515245) + 12345;
return((unsigned int) ((_seed / 65536) % 32768));
}
void srand(seed)
unsigned int seed;
{
_seed = seed;
}