Package org.apache.storm.loadgen
Class NormalDistStats
java.lang.Object
org.apache.storm.loadgen.NormalDistStats
- All Implemented Interfaces:
Serializable
Stats related to something with a normal distribution, and a way to randomly simulate it.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNormalDistStats
(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
Modifier and TypeMethodDescriptionstatic NormalDistStats
Read the stats from a config.static NormalDistStats
Read the stats from a config.double
nextRandom
(Random rand) Generate a random number that follows the statistical distribution.scaleBy
(double v) Scale the stats by v.toConf()
Return this as a config.toString()
-
Field Details
-
mean
public final double mean -
stddev
public final double stddev -
min
public final double min -
max
public final double max
-
-
Constructor Details
-
NormalDistStats
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 Details
-
fromConf
Read the stats from a config.- Parameters:
conf
- the config.- Returns:
- the corresponding stats.
-
fromConf
Read the stats from a config.- Parameters:
conf
- the config.def
- the default mean.- Returns:
- the corresponding stats.
-
toConf
Return this as a config.- Returns:
- the config version of this.
-
nextRandom
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
-
scaleBy
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.
-