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 boolean
m_GenerateDoubles
whether to generate doubles or integers.protected org.apache.commons.math3.random.RandomGenerator
m_Generator
the generator used internally.protected int
m_MaxValue
the maximum value for the numbers to generate.protected int
m_MinValue
the 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 void
check()
Performs optional checks.void
defineOptions()
Adds options to the internal list of options.protected Number
doNext()
Returns the next random number.String
generateDoublesTipText()
Returns the tip text for this property.boolean
getGenerateDoubles()
Returns whether to return doubles or integers.int
getMaxValue()
Returns the maximum value of the integers to generate.int
getMinValue()
Returns the minimum value of the integers to generate.abstract org.apache.commons.math3.random.RandomGenerator
getRandomGenerator()
The underlying random number generator.String
maxValueTipText()
Returns the tip text for this property.String
minValueTipText()
Returns the tip text for this property.void
reset()
Resets the generator.void
setGenerateDoubles(boolean value)
Sets whether to return doubles or integers.void
setMaxValue(int value)
Sets the maximum value of the integers to generate.void
setMinValue(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:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in 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:
setGenerateDoubles
in 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:
getGenerateDoubles
in interfaceCommonsRandomNumberGenerator<Number>
- Returns:
- true if to return doubles, false for integers
-
generateDoublesTipText
public String generateDoublesTipText()
Returns the tip text for this property.- Specified by:
generateDoublesTipText
in 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:
setMinValue
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
setMinValue
in interfaceadams.data.random.RandomIntegerRangeGenerator<Number>
- Parameters:
value
- the minimum
-
getMinValue
public int getMinValue()
Returns the minimum value of the integers to generate.- Specified by:
getMinValue
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
getMinValue
in interfaceadams.data.random.RandomIntegerRangeGenerator<Number>
- Returns:
- the minimum
-
minValueTipText
public String minValueTipText()
Returns the tip text for this property.- Specified by:
minValueTipText
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
minValueTipText
in 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:
setMaxValue
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
setMaxValue
in interfaceadams.data.random.RandomIntegerRangeGenerator<Number>
- Parameters:
value
- the maximum
-
getMaxValue
public int getMaxValue()
Returns the maximum value of the integers to generate.- Specified by:
getMaxValue
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
getMaxValue
in interfaceadams.data.random.RandomIntegerRangeGenerator<Number>
- Returns:
- the maximum
-
maxValueTipText
public String maxValueTipText()
Returns the tip text for this property.- Specified by:
maxValueTipText
in interfaceCommonsRandomNumberGenerator<Number>
- Specified by:
maxValueTipText
in 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:
getRandomGenerator
in interfaceCommonsRandomNumberGenerator<Number>
- Returns:
- the configured generator
-
check
protected void check()
Performs optional checks.
Initializes the internal generator if necessary.- Overrides:
check
in classadams.data.random.AbstractRandomNumberGenerator<Number>
-
-