#ifndef _RAND48_H
#define _RAND48_H

/*
 *  drand48, etc. pseudo-random number generator
 *  This implementation assumes unsigned short integers of at least
 *  16 bits, long integers of at least 32 bits, and ignores
 *  overflows on adding or multiplying two unsigned integers.
 *  Two's-complement representation is assumed in a few places.
 *  Some extra masking is done if unsigneds are exactly 16 bits
 *  or longs are exactly 32 bits, but so what?
 *  An assembly-language implementation would run significantly faster.
 */

double drand48(void);	/* unif random real on [0,1) */
long lrand48(void);	/* unif random int on [0, 2^31-1] */
void srand48(long seedval);	/* seed the lower 32 bits of 48 */

/*
** Seed all 48 bits, and return pointer to the 48 bits we replaced.
*/
unsigned short *seed48(unsigned short seed16v[3]);


/*
** I don't usually use the remainder of these.
*/
long irand48(unsigned short m);
/* Treat x[i] as a 48-bit fraction, and multiply it by the 16-bit
 * multiplier m.  Return integer part as result.
 */

long krand48(unsigned short *xsubi, unsigned short m);
/* same as irand48, except user provides storage in xsubi[] */

long mrand48(void);

void lcong48(unsigned short param[7]);
/*-----*/
double erand48(unsigned short X[3]);
long irand48(unsigned short m);
long krand48(unsigned short X[3], unsigned short m);
long lrand48(void);
long nrand48(unsigned short X[3]);
long mrand48(void);
long jrand48(unsigned short X[3]);
void srand48(long seedval);
unsigned short *seed48(unsigned short seed16v[3]);
void lcong48(unsigned short param[7]);

#endif  /* _RAND48_H */
