DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T r

⟦d913194c2⟧ TextFile

    Length: 525 (0x20d)
    Types: TextFile
    Names: »random.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/Sun/Sdi/random.c« 

TextFile

/*************************  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;
}