* Copyright (c) 1980 The Regents of the University of California.
* This module is believed to contain source code proprietary to AT&T.
* Use and redistribution is subject to the Berkeley Software License
* Agreement and your Software Agreement with AT&T (Western Electric).
static char sccsid
[] = "@(#)random_.c 5.5 (Berkeley) 4/12/91";
* Routines to return random values
* double precision d, drandm
* If arg is nonzero, generator is restarted and value is returned.
* If arg is 0, next value is returned.
* Integer values will range from 0 thru 2147483647 (see random(3)).
* Real values will range from 0.0 thru 1.0 .
#if defined(vax) || defined(tahoe) || defined(hp300)
#define RANDMAX 2147483647
if (*iarg
) srandom((int)*iarg
);
if (*iarg
) srandom((int)*iarg
);
return( (float)(random())/(float)RANDMAX
);
if (*iarg
) srandom((int)*iarg
);
return( (double)(random())/(double)RANDMAX
);