|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.cesr.uranus.core.URandomService
public class URandomService
Uranus - Universal RAndom NUmber Service This is the central class of the framework.
| 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 UranusRandomServicename - the distribution's name
UranusRandomService.isDistributionRegistered(java.lang.String)public boolean isGeneratorRegistered(String name)
UranusRandomService
isGeneratorRegistered in interface UranusRandomServicename - the generator's name
UranusRandomService.isGeneratorRegistered(java.lang.String)
public Uniform getUniform(double from,
double to,
RandomEngine engine)
getUniform in interface UranusRandomServicede.cesr.uranus.core.UranusRandomService#getUniform(double, double,
cern.jet.random.engine.RandomEngine)public Normal getNormal()
UranusRandomServiceNormal 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 UranusRandomServicede.cesr.more.util.MoreRandomService#getNormal()
public Normal createNormal(double mean,
double std)
UranusRandomService
createNormal in interface UranusRandomServicede.cesr.lara.components.util.LaraRandom#createNormal(double, double)
public Normal createNormal(double mean,
double std,
RandomEngine generator)
UranusRandomService
createNormal in interface UranusRandomServicegenerator - the generator to use
de.cesr.lara.components.util.LaraRandom#createNormal(double, double, RandomEngine)public Uniform getUniform()
UranusRandomServiceLaraRandom#getDistribution(MoreRandomServicem.UNIFORM_DEFAULT).
getUniform in interface UranusRandomServicede.cesr.more.util.MoreRandomService#getUniform()
public void registerDistribution(AbstractDistribution dist,
String name)
UranusRandomServiceAbstractDistribution at the given name.
registerDistribution in interface UranusRandomServicede.cesr.more.util.MoreRandomService#registerDistribution(cern.jet.random.AbstractDistribution,
java.lang.String)public Uniform getNewUniformDistribution(RandomEngine engine)
UranusRandomServiceRandomEngine.
Advantage: Uses a UUniformDistributionController in case logger is debug enabled.
getNewUniformDistribution in interface UranusRandomServiceengine - to fed the distribution
de.cesr.more.util.MoreRandomService#getNewUniformDistribution(cern.jet.random.engine.RandomEngine)public void setSeed(int seed)
UranusRandomService
setSeed in interface UranusRandomServicede.cesr.more.util.MoreRandomService#setSeed(int)public int getSeed()
UranusRandomService
getSeed in interface UranusRandomServicede.cesr.more.util.MoreRandomService#getSeed()public static URandomService getURandomService()
public RandomEngine getGenerator(String name)
getGenerator in interface UranusRandomServiceUranusRandomService.getGenerator(java.lang.String)
public void registerGenerator(String name,
RandomEngine generator)
registerGenerator in interface UranusRandomServicename - 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 UranusRandomServicepublic static void reset()
public AbstractDistribution getDistribution(String name)
UranusRandomServiceAbstractDistribution that is registered for the given name.
getDistribution in interface UranusRandomServicede.cesr.more.util.MoreRandomService#getDistribution(java.lang.String)public String identifyDistribution(AbstractDistribution distribution)
identifyDistribution in interface UranusRandomServicepublic String identifyGenerator(RandomEngine generator)
UranusRandomServiceRandomEngine 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 UranusRandomServicede.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 | ||||||||