// random.h: random-number facilities for the CSC 270 simulation example
// -- J. Clarke, March-June 1996

// The class and its functions were renamed in January 1999.

#ifndef _RANDOM_H
#define _RANDOM_H

#include "porting.h"

class Random {
// Manage one stream of random numbers.
//
// The implementation of Random uses the rand48() facility, if
// it's available. The field "xsubi" is used by the rand48 functions
// to store the current state of the random-number stream.

private:
	unsigned short xsubi[3];

public:
	Random (unsigned);
	Random (void);
    // restart stream with seed S
	void setSeed (unsigned long S);
    // return a random "unprocessed" long
	long nextRaw (void);
    // return a random double between 0 and 1
	double nextDouble (void);
    // return a random long between lo and hi
    // (Yes, it really returns a long and not an int.)
	long nextInt (long lo, long hi);
};

// Restart Stream with a new random seed.
void randomize (Random *Stream);

#endif
