[
https://issues.apache.org/jira/browse/RNG-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17376375#comment-17376375
]
Alex Herbert commented on RNG-151:
----------------------------------
{quote}I suppose that a factory will generate any Gaussian distribution
sampler, among which N(0,1) will be a special case
{quote}
Not at the moment. The returned Gaussian implements NormalizedGaussianSampler.
The library currently has the GaussianSampler and all normalized samplers go
through that. So the name should be updated to have Normalized. To create any
Gaussian requires:
{code:java}
// Annoying to not get a GaussianSampler...
SharedStateContinuousSampler s1 =
GaussianSampler.of(ZigguratSampler.NormalizedGaussian.of(rng));
// Use the public constructor
GaussianSampler s2 = new
GaussianSampler(ZigguratSampler.NormalizedGaussian.of(rng));
{code}
RNG-146 will fix the GaussianSampler to avoid use of infinite standard
deviation and may change the sampler to avoid truncation. So this should be the
entry point for Gaussian sampling.
The new class could be updated to support any Gaussian (mean and SD) but that
seems to be a move away from the current design.
> Modified Ziggurat algorithm for normal and exponential sampling
> ---------------------------------------------------------------
>
> Key: RNG-151
> URL: https://issues.apache.org/jira/browse/RNG-151
> Project: Commons RNG
> Issue Type: Improvement
> Components: sampling
> Affects Versions: 1.3
> Reporter: Alex Herbert
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The following paper describes a modification of the ziggurat method for
> sampling normal and exponential deviates:
> {noformat}
> McFarland, C.D. (2016)
> "A modified ziggurat algorithm for generating exponentially and normally
> distributed pseudorandom numbers".
> Journal of Statistical Computation and Simulation 86, 1281-1294.
> {noformat}
> [McFarland (2016) JSCS 86,
> 1281-294|https://www.tandfonline.com/doi/abs/10.1080/00949655.2015.1060234]
> Note: This method is the one that has been chosen as the default
> implementation for the java.util.random.RandomGenerator nextGaussian and
> nextExponential methods to be added in JDK 17.
> The method should be investigated in comparison to the current ziggurat
> method of Marsaglia used in ZigguratNormalizedGaussianSampler and
> ZigguratExponentialSampler.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)