diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-02-09 18:04:22 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-05-02 21:36:44 +0200 |
commit | e98d15d4eb88ec13a6e6ef97e915aada231855fa (patch) | |
tree | 3e8eac4b4da2e33551e98b36995a4a9eee9f7728 /isaac.h | |
parent | 9cdac5c8de53244dcd19aa15d646c022a2614c24 (diff) | |
download | pucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.tar.gz pucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.tar.bz2 pucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.zip |
Replace isaac with xorshift
No difference in performance. rdrand instruction alone is too slow.
Diffstat (limited to 'isaac.h')
-rw-r--r-- | isaac.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/isaac.h b/isaac.h deleted file mode 100644 index 6554569..0000000 --- a/isaac.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ------------------------------------------------------------------------------- -isaac.h: definitions for a random number generator -MODIFIED: - 960327: Creation (addition of randinit, really) - 970719: use context, not global variables, for internal state - 980324: renamed seed to flag - 980605: recommend RANDSIZL=4 for noncryptography. - 991209: modified for inclusion with GNU Backgammon by Gary Wong - 070121: modified for inclusion with flam3 by Erik Reckase ------------------------------------------------------------------------------- -*/ - -#include "isaacs.h" - -#ifndef _ISAAC_H_ -#define _ISAAC_H_ - -#define RANDSIZL (4) /* I recommend 8 for crypto, 4 for simulations */ -#define RANDSIZ (1<<RANDSIZL) - -/* context of random number generator */ -struct randctx -{ - ub4 randcnt; - ub4 randrsl[RANDSIZ]; - ub4 randmem[RANDSIZ]; - ub4 randa; - ub4 randb; - ub4 randc; -}; -typedef struct randctx randctx; - -/* ------------------------------------------------------------------------------- - If (flag==TRUE), then use the contents of randrsl[0..RANDSIZ-1] as the seed. ------------------------------------------------------------------------------- -*/ -void irandinit( randctx *r, word flag ); - -void isaac( randctx *r ); - - -/* ------------------------------------------------------------------------------- - Call irand(/o_ randctx *r _o/) to retrieve a single 32-bit random value ------------------------------------------------------------------------------- -*/ -#define irand(r) \ - (!(r)->randcnt-- ? \ - (isaac(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \ - (r)->randrsl[(r)->randcnt]) - -#endif - - |