/*
 * random.hpp
 *
 * Interface definition for the Random class, which provides basic
 * functionality random number functionality similar to the Java's Random
 * class.  This trivial random number generator does not provide especially
 * strong random numbers.
 */

#ifndef RANDOM_HPP_INCLUDED		// Usual C++ include guard for header
#define RANDOM_HPP_INCLUDED 1


class Random {
public:
    // Constants
    static const unsigned int MAX = 32768;

    // Constructors
    Random();
    Random(unsigned long seed);
    
    // Member Functions
    int next();				// Return next random value [0..MAX)
    int next(int range);		// Return next value in [0..range)

private:
    // Prohibited Operations (assignment & copy construction)
    Random(const Random&);
    Random& operator=(const Random& rhs);

    // Private Constants, Data and Operations

					// Fundamental constants.
    static const unsigned long MULTIPLIER = 1103515245;
    static const unsigned long ADDITIVE   = 12345;
    static const unsigned long DIVISOR    = 65536;
    unsigned long state_;		// State of random number generator.
};

#endif // RANDOM_HPP_INCLUDED
