diff options
Diffstat (limited to 'gnu/lib/libgmp/tests/urandom.h')
-rw-r--r-- | gnu/lib/libgmp/tests/urandom.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gnu/lib/libgmp/tests/urandom.h b/gnu/lib/libgmp/tests/urandom.h new file mode 100644 index 0000000..e018580 --- /dev/null +++ b/gnu/lib/libgmp/tests/urandom.h @@ -0,0 +1,17 @@ +#if defined (hpux) || defined (__alpha__) +/* HPUX lacks random(). DEC Alpha's random() returns a double. */ +static inline unsigned long +urandom () +{ + return mrand48 (); +} +#else +long random (); + +static inline unsigned long +urandom () +{ + /* random() returns 31 bits, we want 32. */ + return random() ^ (random() << 1); +} +#endif |