org.apache.storm.loadgen

## Class NormalDistStats

- java.lang.Object
- - org.apache.storm.loadgen.NormalDistStats

- All Implemented Interfaces:
    Serializable

      public class NormalDistStats
      extends Object
      implements Serializable

  Stats related to something with a normal distribution, and a way to randomly simulate it.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `double` | `max`
    `double` | `mean`
    `double` | `min`
    `double` | `stddev`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NormalDistStats(double mean, double stddev, double min, double max)` A Constructor for the pre computed stats.
    `NormalDistStats(List<Double> values)` Create an instance of this from a list of values.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static NormalDistStats` | `fromConf(Map<String,Object> conf)` Read the stats from a config.
    `static NormalDistStats` | `fromConf(Map<String,Object> conf, Double def)` Read the stats from a config.
    `double` | `nextRandom(Random rand)` Generate a random number that follows the statistical distribution.
    `NormalDistStats` | `scaleBy(double v)` Scale the stats by v.
    `Map<String,Object>` | `toConf()` Return this as a config.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### mean

          public final double mean

    - #### stddev

          public final double stddev

    - #### min

          public final double min

    - #### max

          public final double max

  - ### Constructor Detail

    - #### NormalDistStats

          public NormalDistStats(List<Double> values)

      Create an instance of this from a list of values. The metrics will be computed from the values.

      Parameters:
        `values` - the values to compute metrics from.

    - #### NormalDistStats

          public NormalDistStats(double mean,
                                 double stddev,
                                 double min,
                                 double max)

      A Constructor for the pre computed stats.

      Parameters:
        `mean` - the mean of the values.
        `stddev` - the standard deviation of the values.
        `min` - the min of the values.
        `max` - the max of the values.

  - ### Method Detail

    - #### fromConf

          public static NormalDistStats fromConf(Map<String,Object> conf)

      Read the stats from a config.

      Parameters:
        `conf` - the config.
      Returns:
        the corresponding stats.

    - #### fromConf

          public static NormalDistStats fromConf(Map<String,Object> conf,
                                                 Double def)

      Read the stats from a config.

      Parameters:
        `conf` - the config.
        `def` - the default mean.
      Returns:
        the corresponding stats.

    - #### toConf

          public Map<String,Object> toConf()

      Return this as a config.

      Returns:
        the config version of this.

    - #### nextRandom

          public double nextRandom(Random rand)

      Generate a random number that follows the statistical distribution.

      Parameters:
        `rand` - the random number generator to use
      Returns:
        the next number that should follow the statistical distribution.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### scaleBy

          public NormalDistStats scaleBy(double v)

      Scale the stats by v. This is not scaling everything proportionally. We don’t want the stddev to increase so instead we scale the mean and shift everything up or down by the same amount.

      Parameters:
        `v` - the amount to scale by 1.0 is nothing 0.5 is half.
      Returns:
        a copy of this with the needed adjustments.

Copyright © 2019 The Apache Software Foundation. All rights reserved.