Package adams.data.random
Class AbstractCommonsRandomNumberGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.random.AbstractRandomNumberGenerator<T>
-
- adams.data.random.AbstractSeededRandomNumberGenerator<Number>
-
- adams.data.random.AbstractCommonsRandomNumberGenerator
-
- All Implemented Interfaces:
adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.Randomizable,adams.core.ShallowCopySupporter<adams.data.random.RandomNumberGenerator>,adams.core.SizeOfHandler,CommonsRandomNumberGenerator<Number>,adams.data.random.RandomIntegerRangeGenerator<Number>,adams.data.random.RandomNumberGenerator<Number>,adams.data.random.SeededRandomNumberGenerator<Number>,Serializable
- Direct Known Subclasses:
ISAACRandom,MersenneTwister,Well1024a,Well19937a,Well19937c,Well44497a,Well44497b,Well512a
public abstract class AbstractCommonsRandomNumberGenerator extends adams.data.random.AbstractSeededRandomNumberGenerator<Number> implements CommonsRandomNumberGenerator<Number>, adams.data.random.RandomIntegerRangeGenerator<Number>
Ancestor Apache commons-based random number generators.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_GenerateDoubleswhether to generate doubles or integers.protected org.apache.commons.math3.random.RandomGeneratorm_Generatorthe generator used internally.protected intm_MaxValuethe maximum value for the numbers to generate.protected intm_MinValuethe minimum value for the numbers to generate.
-
Constructor Summary
Constructors Constructor Description AbstractCommonsRandomNumberGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheck()Performs optional checks.voiddefineOptions()Adds options to the internal list of options.protected NumberdoNext()Returns the next random number.StringgenerateDoublesTipText()Returns the tip text for this property.booleangetGenerateDoubles()Returns whether to return doubles or integers.intgetMaxValue()Returns the maximum value of the integers to generate.intgetMinValue()Returns the minimum value of the integers to generate.abstract org.apache.commons.math3.random.RandomGeneratorgetRandomGenerator()The underlying random number generator.StringmaxValueTipText()Returns the tip text for this property.StringminValueTipText()Returns the tip text for this property.voidreset()Resets the generator.voidsetGenerateDoubles(boolean value)Sets whether to return doubles or integers.voidsetMaxValue(int value)Sets the maximum value of the integers to generate.voidsetMinValue(int value)Sets the minimum value of the integers to generate.-
Methods inherited from class adams.data.random.AbstractSeededRandomNumberGenerator
getSeed, seedTipText, setSeed
-
Methods inherited from class adams.data.random.AbstractRandomNumberGenerator
forCommandLine, forName, getGenerators, next, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
m_GenerateDoubles
protected boolean m_GenerateDoubles
whether to generate doubles or integers.
-
m_MinValue
protected int m_MinValue
the minimum value for the numbers to generate.
-
m_MaxValue
protected int m_MaxValue
the maximum value for the numbers to generate.
-
m_Generator
protected org.apache.commons.math3.random.RandomGenerator m_Generator
the generator used internally.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.data.random.AbstractSeededRandomNumberGenerator<Number>
-
reset
public void reset()
Resets the generator.
-
setGenerateDoubles
public void setGenerateDoubles(boolean value)
Sets whether to return doubles or integers.- Specified by:
setGenerateDoublesin interfaceCommonsRandomNumberGenerator<Number>- Parameters:
value- true if to return doubles, false for integers
-
getGenerateDoubles
public boolean getGenerateDoubles()
Returns whether to return doubles or integers.- Specified by:
getGenerateDoublesin interfaceCommonsRandomNumberGenerator<Number>- Returns:
- true if to return doubles, false for integers
-
generateDoublesTipText
public String generateDoublesTipText()
Returns the tip text for this property.- Specified by:
generateDoublesTipTextin interfaceCommonsRandomNumberGenerator<Number>- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMinValue
public void setMinValue(int value)
Sets the minimum value of the integers to generate.- Specified by:
setMinValuein interfaceCommonsRandomNumberGenerator<Number>- Specified by:
setMinValuein interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Parameters:
value- the minimum
-
getMinValue
public int getMinValue()
Returns the minimum value of the integers to generate.- Specified by:
getMinValuein interfaceCommonsRandomNumberGenerator<Number>- Specified by:
getMinValuein interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Returns:
- the minimum
-
minValueTipText
public String minValueTipText()
Returns the tip text for this property.- Specified by:
minValueTipTextin interfaceCommonsRandomNumberGenerator<Number>- Specified by:
minValueTipTextin interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxValue
public void setMaxValue(int value)
Sets the maximum value of the integers to generate.- Specified by:
setMaxValuein interfaceCommonsRandomNumberGenerator<Number>- Specified by:
setMaxValuein interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Parameters:
value- the maximum
-
getMaxValue
public int getMaxValue()
Returns the maximum value of the integers to generate.- Specified by:
getMaxValuein interfaceCommonsRandomNumberGenerator<Number>- Specified by:
getMaxValuein interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Returns:
- the maximum
-
maxValueTipText
public String maxValueTipText()
Returns the tip text for this property.- Specified by:
maxValueTipTextin interfaceCommonsRandomNumberGenerator<Number>- Specified by:
maxValueTipTextin interfaceadams.data.random.RandomIntegerRangeGenerator<Number>- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getRandomGenerator
public abstract org.apache.commons.math3.random.RandomGenerator getRandomGenerator()
The underlying random number generator.- Specified by:
getRandomGeneratorin interfaceCommonsRandomNumberGenerator<Number>- Returns:
- the configured generator
-
check
protected void check()
Performs optional checks.
Initializes the internal generator if necessary.- Overrides:
checkin classadams.data.random.AbstractRandomNumberGenerator<Number>
-
-