diff options
author | markm <markm@FreeBSD.org> | 1995-11-12 14:40:41 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 1995-11-12 14:40:41 +0000 |
commit | d938bb78837327b46dc34873a6eb60c002605808 (patch) | |
tree | d720c213b0c2f268c17d14276e809e876bd37dc8 /gnu/lib/libgmp/tests/urandom.h | |
parent | 7e662b2efdf7b11bed05bdd944746d7b7d0e56af (diff) | |
download | FreeBSD-src-d938bb78837327b46dc34873a6eb60c002605808.zip FreeBSD-src-d938bb78837327b46dc34873a6eb60c002605808.tar.gz |
GNU MP (Multiprecision) library. This is needed by secure RPC (being
done by Bill Paul) and various other BSD programs.
Obtained from:FSF
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 |