SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.rng.BasicRandomStreamFactory Class Reference

Represents a basic random stream factory that can constructs new instances of a given RandomStream implementation via the newInstance method. More...

Inheritance diagram for umontreal.ssj.rng.BasicRandomStreamFactory:
umontreal.ssj.rng.RandomStreamFactory

Public Member Functions

 BasicRandomStreamFactory (Class rsClass)
 Constructs a new basic random stream factory with random stream class rsClass.
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.

Detailed Description

Represents a basic random stream factory that can constructs new instances of a given RandomStream implementation via the newInstance method.

The class name of the implementation to be used must be passed to the constructor as a String, which must be the name of a nullary constructor of a RandomStream object (i.e., a constructor that has no parameters). The streams are constructed by the factory by reflection from this String.

Definition at line 40 of file BasicRandomStreamFactory.java.

Constructor & Destructor Documentation

◆ BasicRandomStreamFactory()

umontreal.ssj.rng.BasicRandomStreamFactory.BasicRandomStreamFactory ( Class rsClass)

Constructs a new basic random stream factory with random stream class rsClass.

The supplied class object must represent an implementation of

RandomStream and must provide a nullary constructor. For example, to construct a factory producing MRG32k3a random streams, this constructor must be called with MRG33k3a.class.

Parameters
rsClassthe random stream class being used.
Exceptions
NullPointerExceptionif `rsClass` is `null`.
IllegalArgumentExceptionif `rsClass` does not represent an implementation of RandomStream, or does not provide a nullary constructor.

Definition at line 56 of file BasicRandomStreamFactory.java.

Member Function Documentation

◆ getRandomStreamClass()

Class umontreal.ssj.rng.BasicRandomStreamFactory.getRandomStreamClass ( )

Returns the random stream class associated with this object.

Returns
the associated random stream class.

Definition at line 66 of file BasicRandomStreamFactory.java.

◆ newInstance()

RandomStream umontreal.ssj.rng.BasicRandomStreamFactory.newInstance ( )

Constructs and returns a new random stream.

If the instantiation of the random stream fails, this method throws a

RandomStreamInstantiationException.

Returns
the newly-constructed random stream.
Exceptions
RandomStreamInstantiationExceptionif the new random stream cannot be instantiated.

Implements umontreal.ssj.rng.RandomStreamFactory.

Definition at line 97 of file BasicRandomStreamFactory.java.

◆ setRandomStreamClass()

void umontreal.ssj.rng.BasicRandomStreamFactory.setRandomStreamClass ( Class rsClass)

Sets the associated random stream class to rsClass.

The supplied class object must represent an implementation of RandomStream and must provide a nullary constructor.

Parameters
rsClassthe random stream class being used.
Exceptions
NullPointerExceptionif `rsClass` is `null`.
IllegalArgumentExceptionif `rsClass` does not represent an implementation of RandomStream, or does not provide a nullary constructor.

Definition at line 81 of file BasicRandomStreamFactory.java.


The documentation for this class was generated from the following file: