|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 485 (0x1e5)
Types: TextFile
Names: »random.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
└─⟦eed978cbf⟧ »EurOpenD3/utils/dbz.tar.Z«
└─⟦0be62e539⟧
└─⟦this⟧ »dbz/random.c«
/*
* random-number generator for testing
*/
static unsigned long next = 1;
/*
- range - generate a random number within an inclusive range
*
* Algorithm from ANSI C standard. Limitation: max-min <= 32767.
*/
int
range(min, max)
int min;
int max;
{
register int temp;
next = next * 1103515245 + 12345;
temp = (int)((next/65536)%32768);
return(temp%(max - min + 1) + min);
}
/*
- seed - seed random number generator
*/
void
seed(n)
long n;
{
next = (unsigned long)n;
}