de.cesr.uranus.core
Interface UranusRandomService

All Known Implementing Classes:
URandomService

public interface UranusRandomService

Uranus - Universal RAndom NUmber Service


Field Summary
static String NORMAL_DEFAULT
          Identifier for default normal stream (not necessarily standard!)
static String UNIFORM_DEFAULT
          Identifier for default uniform stream
 
Method Summary
 Normal createNormal(double mean, double stdDev)
          Create a normal distribution with the given parameters using the default random generator.
 Normal createNormal(double mean, double std, RandomEngine generator)
          Create a normal distribution with the given parameters using the given random generator.
 AbstractDistribution getDistribution(String name)
          Returns the AbstractDistribution that is registered for the given name.
 RandomEngine getGenerator(String name)
           
 Uniform getNewUniformDistribution(RandomEngine engine)
          Returns a Uniform distribution that is fed by the given RandomEngine.
 Normal getNormal()
          Returns the Normal distribution that was created at last (therefore, mean and standard deviation is not defined).
 int getSeed()
          Get the seed currently used for the default distributions.
 Uniform getUniform()
          Return the default uniform distribution.
 Uniform getUniform(double from, double to, RandomEngine engine)
           
 String identifyDistribution(AbstractDistribution distribution)
          Identifies the name of the given AbstractDistribution if registered at this service.
 String identifyGenerator(RandomEngine generator)
          Identifies the name of the given RandomEngine if registered at this service.
 boolean isDebugEnabled()
          Checks if the logger of LRandomService is set to debug.
 boolean isDistributionRegistered(String name)
          Checks whether a distribution with the given name is registered.
 boolean isGeneratorRegistered(String name)
          Checks whether a generator with the given name is registered.
 void registerDistribution(AbstractDistribution dist, String name)
          Registers a custom AbstractDistribution at the given name.
 void registerGenerator(String name, RandomEngine generator)
           
 void setSeed(int seed)
          Sets the seed for all random number generators.
 

Field Detail

UNIFORM_DEFAULT

static final String UNIFORM_DEFAULT
Identifier for default uniform stream

See Also:
Constant Field Values

NORMAL_DEFAULT

static final String NORMAL_DEFAULT
Identifier for default normal stream (not necessarily standard!)

See Also:
Constant Field Values
Method Detail

getUniform

Uniform getUniform()
Return the default uniform distribution. Equivalent to LaraRandom#getDistribution(MoreRandomServicem.UNIFORM_DEFAULT).

Returns:
the default uniform distribution

getUniform

Uniform getUniform(double from,
                   double to,
                   RandomEngine engine)
Parameters:
from -
to -
engine -
Returns:

getNewUniformDistribution

Uniform getNewUniformDistribution(RandomEngine engine)
Returns a Uniform distribution that is fed by the given RandomEngine. Advantage: Uses a UUniformDistributionController in case logger is debug enabled.

Parameters:
engine - to fed the distribution
Returns:
uniform distribution

createNormal

Normal createNormal(double mean,
                    double stdDev)
Create a normal distribution with the given parameters using the default random generator.

Parameters:
mean -
stdDev -
Returns:
normal distribution with the given parameters

createNormal

Normal createNormal(double mean,
                    double std,
                    RandomEngine generator)
Create a normal distribution with the given parameters using the given random generator.

Parameters:
mean -
std -
generator - the generator to use
Returns:
normal distribution with the given parameters

getNormal

Normal getNormal()
Returns the Normal distribution that was created at last (therefore, mean and standard deviation is not defined). Equivalent to UranusRandomService#getDistribution(UranusRandomService.NORMAL_DEFAULT). Returns null if no normal distribution has been created yet.

Returns:
latest created normal distribution

registerDistribution

void registerDistribution(AbstractDistribution dist,
                          String name)
Registers a custom AbstractDistribution at the given name.

Parameters:
dist -
name -

getDistribution

AbstractDistribution getDistribution(String name)
Returns the AbstractDistribution that is registered for the given name.

Parameters:
name -
Returns:
registered distribution

isDistributionRegistered

boolean isDistributionRegistered(String name)
Checks whether a distribution with the given name is registered.

Parameters:
name - the distribution's name
Returns:
true if the distribution is registered

registerGenerator

void registerGenerator(String name,
                       RandomEngine generator)
Parameters:
name - to associate the given generator with
generator - to register

getGenerator

RandomEngine getGenerator(String name)
Parameters:
name -
Returns:
random engine that is associated with the given String

isGeneratorRegistered

boolean isGeneratorRegistered(String name)
Checks whether a generator with the given name is registered.

Parameters:
name - the generator's name
Returns:
true if the generator is registered

setSeed

void setSeed(int seed)
Sets the seed for all random number generators. If this method is called, a new random number generator is created, all registered distributions (also customly registered) are deleted and the default distributions are renewed.

Parameters:
seed -

getSeed

int getSeed()
Get the seed currently used for the default distributions.

Returns:
current seed

isDebugEnabled

boolean isDebugEnabled()
Checks if the logger of LRandomService is set to debug.

Returns:
true if debug is enabled.

identifyDistribution

String identifyDistribution(AbstractDistribution distribution)
Identifies the name of the given AbstractDistribution if registered at this service. NOTE: The lookup is time consuming since this operation is meant to be use only for debugging purposes, and the service is optimised for other uses.

Parameters:
generator -
Returns:

identifyGenerator

String identifyGenerator(RandomEngine generator)
Identifies the name of the given RandomEngine if registered at this service. NOTE: The lookup is time consuming since this operation is meant to be use only for debugging purposes, and the service is optimised for other uses.

Parameters:
generator -
Returns: