class RandomNumberGenerator

{

public:

RandomNumberGenerator( unsigned int seed=123456789 ) : randomSeed(seed)

{

}

void setSeed( unsigned int seed )

{

randomSeed = seed;

}

unsigned int get( void )

{

randomSeed = MULTIPLIER * (randomSeed % Q) - R * (randomSeed / Q);

return randomSeed;

}

private:

enum

{

MODULUS    = 2147483647 // DON'T CHANGE THIS VALUE

,MULTIPLIER = 48271      // DON'T CHANGE THIS VALUE

,Q          = (MODULUS / MULTIPLIER)

,R          = (MODULUS % MULTIPLIER)

};

unsigned int randomSeed;

};