25package umontreal.ssj.rng;
27import umontreal.ssj.rng.RandomStream;
28import umontreal.ssj.rng.MRG32k3a;
41 private Class rsClass;
57 checkRandomStreamClass(rsClass);
58 this.rsClass = rsClass;
82 checkRandomStreamClass(rsClass);
83 this.rsClass = rsClass;
86 private void checkRandomStreamClass(
final Class rsClass) {
88 throw new IllegalArgumentException(
"The random class must implement the RandomStream interface");
90 rsClass.getConstructor(
new Class[0]);
91 }
catch (NoSuchMethodException nme) {
92 throw new IllegalArgumentException(
93 "The random stream class " + rsClass.getName() +
" does not have a " +
"nullary public constructor.");
100 }
catch (IllegalAccessException iae) {
102 "Cannot access constructor for random stream class " + rsClass.getName(), iae);
103 }
catch (InstantiationException ie) {
105 "Cannot instantiate random stream class " + rsClass.getName(), ie);
106 }
catch (Exception e) {
108 "Exception while calling the nullary constructor for random stream class " + rsClass.getName(), e);
112 public String toString() {
113 return "Basic random stream factory constructing streams of class " + rsClass.getName();
Class getRandomStreamClass()
Returns the random stream class associated with this object.
void setRandomStreamClass(Class rsClass)
Sets the associated random stream class to rsClass.
RandomStream newInstance()
Constructs and returns a new random stream.
BasicRandomStreamFactory(Class rsClass)
Constructs a new basic random stream factory with random stream class rsClass.
This exception is thrown when a random stream factory cannot instantiate a stream on a call to its um...
Represents a random stream factory capable of constructing instances of a given type of random stream...
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...