#ifndef MATH_RANDOM_H
#define MATH_RANDOM_H

#include <math.h>



class random
{

  private:

    unsigned long   m_iSeed;

		long            m_iP;

		long            m_iA;


  public:

    random( const unsigned long seed = 0 )
      : m_iSeed( seed & 0x0000FFFF ),
        m_iP( 1234567 ),
        m_iA( 1234    )
    {}

    void            seed( const unsigned long seed ) 
    { 
      m_iSeed = seed & 0x0000FFFF; 
    }

    unsigned long   seed() const                     
    { 
      return m_iSeed; 
    }

    unsigned long   rand( const unsigned long dwBereich )
    { 
      m_iSeed = ( m_iA * m_iSeed + m_iA ) % m_iP;
	    return ( dwBereich * m_iSeed ) / m_iP;
    }

};


#endif // MATH_RANDOM_H
