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 NormalizedGaussianSamplerUnderlying normalized Gaussian sampler. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublesample()Creates adoublesample.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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 adoublesample.- 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:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateContinuousSampler>- Specified by:
withUniformRandomProviderin classTSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-