/* ------------------------------------------------------------------------------ isaac64.h: Definitions for a fast cryptographic random number generator Bob Jenkins, 1996, Public Domain Modified for modularity by Tom Bartol and Rex Kerr Reference: http://burtleburtle.net/bob/rand/isaacafa.html Jenkins, R.J. (1996) ISAAC, in Fast Software Encryption, vol. 1039, ed. Gollmann, D. Spinger-Verlag, Cambridge ------------------------------------------------------------------------------ */ #ifndef ISAAC64_H #define ISAAC64_H #define RANDSIZL (4) /* I recommend 8 for crypto, 4 for simulations */ #define RANDSIZ (1<randcnt>0 ? \ ( *(((ub4 *)(rng->randrsl)) + (rng->randcnt-=1)) ) : \ ( isaac64_generate(rng), \ rng->randcnt=RANDMAX-1, \ *(((ub4 *)(rng->randrsl)) + rng->randcnt) )) #define isaac64_uint64(rng) \ (rng->randcnt>1 ? \ ( *((ub8 *)(((ub4 *)(rng->randrsl)) + (rng->randcnt-=2))) ) : \ ( isaac64_generate(rng), \ rng->randcnt=RANDMAX-2, \ *((ub8 *)(((ub4 *)(rng->randrsl)) + rng->randcnt)) )) #define isaac64_dbl32(rng) \ (rng->randcnt>0 ? \ ( DBL32 * (*(((ub4 *)(rng->randrsl)) + (rng->randcnt-=1)) ) ) : \ ( isaac64_generate(rng), \ rng->randcnt=RANDMAX-1, \ DBL32 * (*(((ub4 *)(rng->randrsl)) + rng->randcnt)) )) #define isaac64_dbl53(rng) \ (rng->randcnt>1 ? \ ( DBL53 * ((*((ub8 *)(((ub4 *)(rng->randrsl)) + (rng->randcnt-=2))))>>11) ) : \ ( isaac64_generate(rng), \ rng->randcnt=RANDMAX-2, \ DBL64 * ((*((ub8 *)(((ub4 *)(rng->randrsl)) + rng->randcnt)))>>11) )) #define isaac64_dbl64(rng) \ (rng->randcnt>1 ? \ ( DBL64 * (*((ub8 *)(((ub4 *)(rng->randrsl)) + (rng->randcnt-=2)))) ) : \ ( isaac64_generate(rng), \ rng->randcnt=RANDMAX-2, \ DBL64 * (*((ub8 *)(((ub4 *)(rng->randrsl)) + rng->randcnt))) )) #endif /* ISAAC64_H */