|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 |
public java.lang.String getPRNGName()
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());
CollingsPRNGAdministrator admin = new CollingsPRNGAdministrator();
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |