freebsd-dev/gnu/lib/libgmp/tests/urandom.h
Mark Murray ae82e96f8c GNU MP (Multiprecision) library. This is needed by secure RPC (being
done by Bill Paul) and various other BSD programs.
Obtained from:FSF
1995-11-12 14:40:41 +00:00

18 lines
331 B
C

#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