Class 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.
      • Fields inherited from class adams.data.random.AbstractSeededRandomNumberGenerator

        m_Seed
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • 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 interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
      • Methods inherited from interface adams.data.random.RandomNumberGenerator

        next
      • Methods inherited from interface adams.core.ShallowCopySupporter

        shallowCopy, shallowCopy
    • 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.
    • Constructor Detail

      • AbstractCommonsRandomNumberGenerator

        public AbstractCommonsRandomNumberGenerator()
    • Method Detail

      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.random.AbstractSeededRandomNumberGenerator<Number>
      • reset

        public void reset()
        Resets the generator.
        Specified by:
        reset in interface adams.data.random.RandomNumberGenerator<Number>
        Overrides:
        reset in class adams.data.random.AbstractRandomNumberGenerator<Number>
      • setGenerateDoubles

        public void setGenerateDoubles​(boolean value)
        Sets whether to return doubles or integers.
        Specified by:
        setGenerateDoubles in interface CommonsRandomNumberGenerator<Number>
        Parameters:
        value - true if to return doubles, false for integers
      • setMinValue

        public void setMinValue​(int value)
        Sets the minimum value of the integers to generate.
        Specified by:
        setMinValue in interface CommonsRandomNumberGenerator<Number>
        Specified by:
        setMinValue in interface adams.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 interface CommonsRandomNumberGenerator<Number>
        Specified by:
        getMinValue in interface adams.data.random.RandomIntegerRangeGenerator<Number>
        Returns:
        the minimum
      • minValueTipText

        public String minValueTipText()
        Returns the tip text for this property.
        Specified by:
        minValueTipText in interface CommonsRandomNumberGenerator<Number>
        Specified by:
        minValueTipText in interface adams.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 interface CommonsRandomNumberGenerator<Number>
        Specified by:
        setMaxValue in interface adams.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 interface CommonsRandomNumberGenerator<Number>
        Specified by:
        getMaxValue in interface adams.data.random.RandomIntegerRangeGenerator<Number>
        Returns:
        the maximum
      • maxValueTipText

        public String maxValueTipText()
        Returns the tip text for this property.
        Specified by:
        maxValueTipText in interface CommonsRandomNumberGenerator<Number>
        Specified by:
        maxValueTipText in interface adams.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 interface CommonsRandomNumberGenerator<Number>
        Returns:
        the configured generator
      • check

        protected void check()
        Performs optional checks.

        Initializes the internal generator if necessary.
        Overrides:
        check in class adams.data.random.AbstractRandomNumberGenerator<Number>
      • doNext

        protected Number doNext()
        Returns the next random number. Does the actual computation.
        Specified by:
        doNext in class adams.data.random.AbstractRandomNumberGenerator<Number>
        Returns:
        the next number