Class UnitSphereSampler.UnitSphereSampler1D
java.lang.Object
org.apache.commons.rng.sampling.UnitSphereSampler
org.apache.commons.rng.sampling.UnitSphereSampler.UnitSphereSampler1D
- All Implemented Interfaces:
ObjectSampler<double[]>, SharedStateObjectSampler<double[]>, SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
UnitSphereSampler
Sample uniformly from the ends of a 1D unit line.
- Since:
- 1.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]sample()Create an object 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 UnitSphereSampler
nextVector, ofMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectSampler
samples, samples
-
Field Details
-
rng
The source of randomness.
-
-
Constructor Details
-
UnitSphereSampler1D
UnitSphereSampler1D(UniformRandomProvider rng) - Parameters:
rng- Source of randomness.
-
-
Method Details
-
sample
public double[] sample()Description copied from interface:ObjectSamplerCreate an object sample.- Specified by:
samplein interfaceObjectSampler<double[]>- Overrides:
samplein classUnitSphereSampler- Returns:
- a random normalized Cartesian vector.
-
withUniformRandomProvider
Description copied from class:UnitSphereSamplerCreate 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<SharedStateObjectSampler<double[]>>- Overrides:
withUniformRandomProviderin classUnitSphereSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-