Class TSampler.NormalTSampler
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.TSampler
-
- org.apache.commons.rng.sampling.distribution.TSampler.NormalTSampler
-
- All Implemented Interfaces:
ContinuousSampler
,SharedStateContinuousSampler
,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- TSampler
private static final class TSampler.NormalTSampler extends TSampler
Sample from a t-distribution using a normal distribution. This is used when the degrees of freedom is extremely large (e.g.> 1e16
).
-
-
Field Summary
Fields Modifier and Type Field Description private NormalizedGaussianSampler
sampler
Underlying normalized Gaussian sampler.
-
Constructor Summary
Constructors Constructor Description NormalTSampler(UniformRandomProvider rng)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
sample()
Creates adouble
sample.TSampler.NormalTSampler
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.-
Methods inherited from class org.apache.commons.rng.sampling.distribution.TSampler
nextLong, of, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.distribution.ContinuousSampler
samples, samples
-
-
-
-
Field Detail
-
sampler
private final NormalizedGaussianSampler sampler
Underlying normalized Gaussian sampler.
-
-
Constructor Detail
-
NormalTSampler
NormalTSampler(UniformRandomProvider rng)
- Parameters:
rng
- Generator of uniformly distributed random numbers.
-
-
Method Detail
-
sample
public double sample()
Creates adouble
sample.- Returns:
- a sample.
-
withUniformRandomProvider
public TSampler.NormalTSampler withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateContinuousSampler>
- Specified by:
withUniformRandomProvider
in classTSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-