|
|
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 - downloadIndex: T r
Length: 525 (0x20d)
Types: TextFile
Names: »random.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/Sun/Sdi/random.c«
/************************* random.c ***************************/
/*
* NOT Copyright 1987 by Mark Weiser.
* This routine placed in the public domain. (:-)
*/
/*
* returns a normally distributed random number
*/
#define MAXRANDOM (~(1<<31))
#define COUNT (8)
#define SD (1000)
normal(mean,sd)
{
long a, b, c, d, e, f;
register long sum = 0;
long random();
register int count=COUNT;
while (count--) {
sum += random() / (COUNT*SD);
}
return ((sum - (MAXRANDOM/(2*SD)))*sd)/(MAXRANDOM/(COUNT*SD)) + mean;
}