diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:13:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:13:02 +0000 |
commit | e244c93d21bcacf1a0eedefdcc3018a362274796 (patch) | |
tree | 857e0d7bcf20546b38fff97a8702c2c1240bc23b /src/isaac_rand/isaac64.h | |
parent | Initial commit. (diff) | |
download | nwipe-e244c93d21bcacf1a0eedefdcc3018a362274796.tar.xz nwipe-e244c93d21bcacf1a0eedefdcc3018a362274796.zip |
Adding upstream version 0.36.upstream/0.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/isaac_rand/isaac64.h')
-rw-r--r-- | src/isaac_rand/isaac64.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/isaac_rand/isaac64.h b/src/isaac_rand/isaac64.h new file mode 100644 index 0000000..e2ab55b --- /dev/null +++ b/src/isaac_rand/isaac64.h @@ -0,0 +1,41 @@ +/* +------------------------------------------------------------------------------ +isaac64.h: definitions for a random number generator +Bob Jenkins, 1996, Public Domain +------------------------------------------------------------------------------ +*/ +#ifndef ISAAC64 +#define ISAAC64 + +#include "isaac_standard.h" + +struct rand64ctx +{ + ub8 randrsl[RANDSIZ], randcnt; + ub8 mm[RANDSIZ]; + ub8 aa, bb, cc; +}; +typedef struct rand64ctx rand64ctx; + +/* +------------------------------------------------------------------------------ + If (flag==TRUE), then use the contents of randrsl[0..255] as the seed. +------------------------------------------------------------------------------ +*/ +void rand64init(rand64ctx *r, word flag); + +void isaac64(rand64ctx *ctx); + + +/* +------------------------------------------------------------------------------ + Call rand64() to retrieve a single 64-bit random value +------------------------------------------------------------------------------ +*/ +#define isaac64_rand() \ + (!(r)->randcnt-- ? \ + (isaac64(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->>randcnt]) : \ + (r)->randrsl[(r)->randcnt]) + +#endif /* ISAAC64 */ + |