de.cesr.lara.components.util
Interface LaraRandom

All Known Implementing Classes:
LRandomService

public interface LaraRandom


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 getCustomNormal(double mean, double std, String name)
           
 AbstractDistribution getDistribution(String name)
          Returns the AbstractDistribution that is registered for the given name.
 RandomEngine getGenerator(String name)
           
 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.
 boolean isDebugEnabled()
          Checks if the logger of LRandomService is set to debug.
 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

NORMAL_DEFAULT

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

See Also:
Constant Field Values

UNIFORM_DEFAULT

static final String UNIFORM_DEFAULT
Identifier for default uniform stream

See Also:
Constant Field Values
Method Detail

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

getCustomNormal

Normal getCustomNormal(double mean,
                       double std,
                       String name)
Parameters:
mean -
std -
name - name of the generator to use from stored generators
Returns:
normal distribution

getDistribution

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

Parameters:
name -
Returns:
registered distribution

getGenerator

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

getNormal

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

Returns:
latest created normal distribution

getSeed

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

Returns:
current seed

getUniform

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

Returns:
the default uniform distribution

isDebugEnabled

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

Returns:
true if debug is enabled.

registerDistribution

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

Parameters:
dist -
name -

registerGenerator

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

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 -