Alex Herbert created RNG-134:
--------------------------------
Summary: BoxSampler to sampler uniformly from a box (or
hyperrectangle)
Key: RNG-134
URL: https://issues.apache.org/jira/browse/RNG-134
Project: Commons RNG
Issue Type: New Feature
Components: sampling
Affects Versions: 1.4
Reporter: Alex Herbert
Assignee: Alex Herbert
Create a sampler to sample uniformly within a
[hyperrectangle|https://en.wikipedia.org/wiki/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.
{code:java}
public abstract class BoxSampler implements
SharedStateSampler<BoxSampler> {
public static BoxSampler of(double[] a,
double[] b,
UniformRandomProvider rng);
}
{code}
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):
{noformat}
p = a + u * (b - a)
= a + ub - ua
= (1 - u)a + ub
{noformat}
This will produce the same results as using an instance of the the
{{ContinuousUniformSampler}} for each dimension with all samplers using a
common RNG.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)