public class TruncatedNormalDistribution extends Object implements ContinuousDistribution
References:
Modifier and Type | Field and Description |
---|---|
private RNG |
generator |
private double |
lower |
private double |
mean |
private double |
sd |
private double |
upper |
Constructor and Description |
---|
TruncatedNormalDistribution(double mean,
double sd,
double lb,
double ub)
Create an instance of the normal distribution distribution truncated to given limits.
|
Modifier and Type | Method and Description |
---|---|
double |
rejectionSample() |
double |
sample()
Obtain a sample from the distribution.
|
private double mean
private double sd
private double lower
private double upper
private RNG generator
public TruncatedNormalDistribution(double mean, double sd, double lb, double ub)
mean
- the mean of the normal distribution.sd
- the standard deviation of the distribution.lb
- the lower bound of the distribution, no values lower than this will be returned.ub
- the upper bound of the distribution, no values higher1 than this will be returned.public double sample()
ContinuousDistribution
sample
in interface ContinuousDistribution
public double rejectionSample()
Copyright © 2015 University of Glasgow. All rights reserved.