|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.cesr.uranus.core.URandomService
public class URandomService
Uranus - Universal RAndom NUmber Service
Field Summary | |
---|---|
protected static URandomService |
randomService
|
Fields inherited from interface de.cesr.uranus.core.UranusRandomService |
---|
NORMAL_DEFAULT, UNIFORM_DEFAULT |
Constructor Summary | |
---|---|
URandomService(int seed)
Initialise a new instance with the given random seed. |
Method Summary | |
---|---|
Normal |
createNormal(double mean,
double std)
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)
|
static URandomService |
getURandomService()
Return the universal random manager. |
String |
identifyDistribution(AbstractDistribution distribution)
UranusRandomService#identifyDistribution(cern.jet.random. |
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)
|
static void |
reset()
Resets the current instance of random service (clears distribution and generator collections). |
void |
setSeed(int seed)
Sets the seed for all random number generators. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static URandomService randomService
Constructor Detail |
---|
public URandomService(int seed)
seed
- Method Detail |
---|
public boolean isDistributionRegistered(String name)
UranusRandomService
isDistributionRegistered
in interface UranusRandomService
name
- the distribution's name
UranusRandomService.isDistributionRegistered(java.lang.String)
public boolean isGeneratorRegistered(String name)
UranusRandomService
isGeneratorRegistered
in interface UranusRandomService
name
- the generator's name
UranusRandomService.isGeneratorRegistered(java.lang.String)
public Uniform getUniform(double from, double to, RandomEngine engine)
getUniform
in interface UranusRandomService
de.cesr.uranus.core.UranusRandomService#getUniform(double, double,
cern.jet.random.engine.RandomEngine)
public Normal getNormal()
UranusRandomService
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.
getNormal
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#getNormal()
public Normal createNormal(double mean, double std)
UranusRandomService
createNormal
in interface UranusRandomService
de.cesr.lara.components.util.LaraRandom#createNormal(double, double)
public Normal createNormal(double mean, double std, RandomEngine generator)
UranusRandomService
createNormal
in interface UranusRandomService
generator
- the generator to use
de.cesr.lara.components.util.LaraRandom#createNormal(double, double, RandomEngine)
public Uniform getUniform()
UranusRandomService
LaraRandom#getDistribution(MoreRandomServicem.UNIFORM_DEFAULT)
.
getUniform
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#getUniform()
public void registerDistribution(AbstractDistribution dist, String name)
UranusRandomService
AbstractDistribution
at the given name.
registerDistribution
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#registerDistribution(cern.jet.random.AbstractDistribution,
java.lang.String)
public Uniform getNewUniformDistribution(RandomEngine engine)
UranusRandomService
RandomEngine
.
Advantage: Uses a UUniformDistributionController
in case logger is debug enabled.
getNewUniformDistribution
in interface UranusRandomService
engine
- to fed the distribution
de.cesr.more.util.MoreRandomService#getNewUniformDistribution(cern.jet.random.engine.RandomEngine)
public void setSeed(int seed)
UranusRandomService
setSeed
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#setSeed(int)
public int getSeed()
UranusRandomService
getSeed
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#getSeed()
public static URandomService getURandomService()
public RandomEngine getGenerator(String name)
getGenerator
in interface UranusRandomService
UranusRandomService.getGenerator(java.lang.String)
public void registerGenerator(String name, RandomEngine generator)
registerGenerator
in interface UranusRandomService
name
- to associate the given generator withgenerator
- to registerde.cesr.uranus.core.UranusRandomService#registerGenerator(java.lang.String, cern.jet.random.engine.RandomEngine)
public boolean isDebugEnabled()
UranusRandomService
isDebugEnabled
in interface UranusRandomService
public static void reset()
public AbstractDistribution getDistribution(String name)
UranusRandomService
AbstractDistribution
that is registered for the given name.
getDistribution
in interface UranusRandomService
de.cesr.more.util.MoreRandomService#getDistribution(java.lang.String)
public String identifyDistribution(AbstractDistribution distribution)
identifyDistribution
in interface UranusRandomService
public String identifyGenerator(RandomEngine generator)
UranusRandomService
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.
identifyGenerator
in interface UranusRandomService
de.cesr.uranus.core.UranusRandomService#identifyGenerator(cern.jet.random.engine.RandomEngine)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |