Description
Create a sampler to sample uniformly within a hyperrectangle.
Alternative names for a hyperrectangle are a box or an orthotope. Below I use the term box for simplicity and to match the BallSampler for an n-ball.
public abstract class BoxSampler implements SharedStateSampler<BoxSampler> { public static BoxSampler of(double[] a, double[] b, UniformRandomProvider rng); }
Inputs a and b are the minimum and maximum of the box in each dimension.
Sampling can be performed using the same method as the LineSampler but using a uniform deviate for each dimension (instead of the same deviate for all dimensions):
p = a + u * (b - a) = a + ub - ua = (1 - u)a + ub
This will produce the same results as using an instance of the the ContinuousUniformSampler for each dimension with all samplers using a common RNG.
Attachments
Issue Links
- is a child of
-
RNG-132 Package rng.sampling.shape for sampling coordinates from shapes
- Closed