Class StochasticGenerator


  • public final class StochasticGenerator
    extends Object
    Generator of random values according to stochastic laws.
    Since:
    13.0
    Version:
    17.0 2020-01-04 14:41:41
    Author:
    Christophe BOHRHAUER
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathstochastic
    • Method Detail

      • generateRandomValue

        @Pure
        public static double generateRandomValue​(StochasticLaw law)
                                          throws MathException
        Generate a stochastic value according to the given law.

        A probability p is randomly selected using the specified random number list. The returned value is when a randomly selected value inside the set of available values.

        This method uses a uniform distribution random number generation.

        Parameters:
        law - is the stochastic law to use.
        Returns:
        a value which was randomly selected according to a stochastic law.
        Throws:
        MathException - in case the value could not be computed.
      • noiseValue

        @Pure
        public static double noiseValue​(double value,
                                        MathFunction noiseLaw)
                                 throws MathException
        Add a noise to the specified value.

        The returned value is given by: (value-noise) < value < (value+noise) where 0 <= noise <= max(abs(value), noiseLaw(value)). The noise is randomly selected according to the given random number list.

        This method uses a uniform distribution random number generation.

        Parameters:
        value - is the value to noise
        noiseLaw - is the law used to selected tyhe noise amount.
        Returns:
        the value
        Throws:
        MathException - is case the value is not valid