org.omegahat.Simulation.RandomGenerators
Interface PRNGState

All Known Subinterfaces:
PRNGIntegerState

public interface PRNGState

Enapsulates all of the state information of a PRNG. Given a copy of the PRNGState corresponding to a specific PRNG, it should be possible to exactly duplicate the random number stream produced.


Method Summary
 java.lang.String getPRNGName()
          Return the name of the class that can be enstantiated from this state.
 

Method Detail

getPRNGName

public java.lang.String getPRNGName()
Return the name of the class that can be enstantiated from this state.
Returns:
fully qualified class name The fully qualified class name can be used to instantiate the PRNG without knowing any of its details. For example:

CollingsPRNGAdministrator admin = new CollingsPRNGAdministrator();

PRNGState state = admin.registerPRNGState();

String name = state.getPRNGName();

Class cl = Class.forName(name);

Class classes[] = new Class[1];

classes[0] = Class.forName("org.omegahat.Simulation.RandomGenerators.PRNGState");

java.lang.reflect.Constructor c = cl.getConstructor(classes);

Object[] args = new Object[1];

args[0] = state;

PRNG prng = (PRNG)

c.newInstance(args);

for(int a=1; a<10; a++)

System.out.println(prng.nextInt());