org.zmpp.vmutil
Class PredictableRandomGenerator

java.lang.Object
  extended by org.zmpp.vmutil.PredictableRandomGenerator
All Implemented Interfaces:
RandomGenerator

public class PredictableRandomGenerator
extends Object
implements RandomGenerator

This class implements the predictable random number generator mentioned in the Z machine standards document. It takes a seed and generates the same sequence of numbers for equal seeds.

Version:
1.0
Author:
Wei-ju Wu

Field Summary
 
Fields inherited from interface org.zmpp.vmutil.RandomGenerator
MAX_VALUE
 
Constructor Summary
PredictableRandomGenerator(long seed)
          Constructor.
 
Method Summary
 int next()
          Returns the next random value between 1 and MAX_VALUE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredictableRandomGenerator

public PredictableRandomGenerator(long seed)
Constructor.

Parameters:
seed - the start seed.
Method Detail

next

public int next()
Returns the next random value between 1 and MAX_VALUE.

Specified by:
next in interface RandomGenerator
Returns:
a random int value


Copyright © 2005 . All Rights Reserved.