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
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
FieldsModifier and TypeFieldDescriptionprivate final NormalizedGaussianSampler
Underlying normalized Gaussian sampler. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
sample()
Creates adouble
sample.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 Details
-
sampler
Underlying normalized Gaussian sampler.
-
-
Constructor Details
-
NormalTSampler
NormalTSampler(UniformRandomProvider rng) - Parameters:
rng
- Generator of uniformly distributed random numbers.
-
-
Method Details
-
sample
public double sample()Creates adouble
sample.- Returns:
- a sample.
-
withUniformRandomProvider
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
-