public class NormalDistStats extends Object implements Serializable
Stats related to something with a normal distribution, and a way to randomly simulate it.
Modifier and Type | Field and Description |
---|---|
double |
max |
double |
mean |
double |
min |
double |
stddev |
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.
|
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() |
public final double mean
public final double stddev
public final double min
public final double max
public NormalDistStats(List<Double> values)
Create an instance of this from a list of values. The metrics will be computed from the values.
values
- the values to compute metrics from.public NormalDistStats(double mean, double stddev, double min, double max)
A Constructor for the pre computed stats.
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.public static NormalDistStats fromConf(Map<String,Object> conf)
Read the stats from a config.
conf
- the config.public static NormalDistStats fromConf(Map<String,Object> conf, Double def)
Read the stats from a config.
conf
- the config.def
- the default mean.public Map<String,Object> toConf()
Return this as a config.
public double nextRandom(Random rand)
Generate a random number that follows the statistical distribution.
rand
- the random number generator to usepublic 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.
v
- the amount to scale by 1.0 is nothing 0.5 is half.Copyright © 2019 The Apache Software Foundation. All rights reserved.