Next: shutdown.h, Previous: prompt.h, Up: Top [Contents][Index]
"calib/random.h"
Header.The "calib/random.h"
header contains various facilities for
generating random numbers.
The random numbers generated herein are far from being
cryptographically sound — they are used only for various algebraic
algorithms (i.e., distinct-degree factorization in Zp[x]) that do not
require a high degree of randomness.
Only one initial seed is supported, and no randomization by wall time
or similar means is provided.
The following random state object is defined:
struct calib_Random { calib_int32u lo; calib_int32u hi; double normal_val2; /* Cache 2nd normal deviate */ int normal_flag; /* val2 is valid iff flag is TRUE */ };
void calib_random_init (struct calib_Random * state);
Initialize the given random state object state
.
double calib_random (struct calib_Random * state);
Return a double-precision value uniformly distributed in the half-open
interval [0.0, 1.0)
.
double calib_random_normal (struct calib_Random * state);
Return a double-precision value normally distributed with mean
0.0
and variance 1.0
.
calib_int32u calib_random_u32 (struct calib_Random * state);
Return a uniformly distributed unsigned 32-bit value.
calib_int64u calib_random_u64 (struct calib_Random * state);
Return a uniformly distributed unsigned 64-bit value.