You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/02/13 16:20:23 UTC

[commons-rng] branch master updated (8ab77a6 -> 367f022)

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git.


    from 8ab77a6  Javadoc fix
     new 3c4c9d2  Remove trailing whitespace
     new 367f022  The commons-math distributions can use a null random generator

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 commons-rng-client-api/src/site/site.xml           |  2 +-
 commons-rng-client-api/src/site/xdoc/index.xml     |  2 +-
 commons-rng-core/src/site/site.xml                 |  2 +-
 commons-rng-core/src/site/xdoc/index.xml           |  2 +-
 .../rng/core/source64/MersenneTwister64Test.java   |  4 +-
 .../sampling/UniformSamplingVisualCheck.java       |  2 +-
 commons-rng-sampling/src/site/site.xml             |  2 +-
 commons-rng-sampling/src/site/xdoc/index.xml       |  2 +-
 .../distribution/ContinuousSamplersList.java       | 76 ++++++++++++----------
 .../DiscreteSamplerParametricTest.java             |  2 +-
 .../distribution/DiscreteSamplersList.java         | 41 +++++++-----
 commons-rng-simple/src/site/site.xml               |  2 +-
 commons-rng-simple/src/site/xdoc/index.xml         |  2 +-
 .../rng/simple/internal/SeedFactoryTest.java       |  2 +-
 src/changes/changes.xml                            |  2 +-
 src/site/site.xml                                  |  6 +-
 src/site/xdoc/developers.xml                       | 28 ++++----
 src/site/xdoc/index.xml                            |  2 +-
 src/site/xdoc/userguide/index.xml                  |  8 +--
 19 files changed, 99 insertions(+), 90 deletions(-)


Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Alex Herbert <al...@gmail.com>.
On 14/02/2019 12:42, Gilles Sadowski wrote:
> Hello Herbert.
>
> Le jeu. 14 févr. 2019 à 12:58, Alex Herbert <al...@gmail.com> a écrit :
>> On 13/02/2019 22:28, Gilles Sadowski wrote:
>>> Hi.
>>>
>>> Le mer. 13 févr. 2019 à 21:21, Alex Herbert <al...@gmail.com> a écrit :
>>>>
>>>>> On 13 Feb 2019, at 17:52, Gilles Sadowski <gi...@gmail.com> wrote:
>>>>>
>>>>>> Le mer. 13 févr. 2019 à 18:47, Alex Herbert <al...@gmail.com> a écrit :
>>>>>>
>>>>>>> On 13/02/2019 17:35, Gilles Sadowski wrote:
>>>>>>> Hello.
>>>>>>>
>>>>>>>> Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
>>>>>>>> This is an automated email from the ASF dual-hosted git repository.
>>>>>>>>
>>>>>>>> aherbert pushed a commit to branch master
>>>>>>>> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
>>>>>>>>
>>>>>>>> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
>>>>>>>> Author: aherbert <ah...@apache.org>
>>>>>>>> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
>>>>>>>>
>>>>>>>>       The commons-math distributions can use a null random generator
>>>>>>> Not a good move, I 'd think: this constructor has disappeared from
>>>>>>> the development version of CM.[1]
>>>>>> The constructor is in the unit tests. These depend on commons-math3 in
>>>>>> the test scope.
>>>>>>
>>>>>> If the tests are upgraded to commons-math4 then this will just be a
>>>>>> compile error. The tests would have to be changed anyway to reference
>>>>>> the updated component package name for maths.
>>>>> I know; the point is that this constructor was a bad design
>>>>> decision (there are old and long discussions about it).
>>>>> So, why present wrong usage in [RNG] (that would a.o. lead
>>>>> to wondering why the constructor was deleted)?
>>>>>
>>>> I thought I was changing to the recommended usage.
>>>>
>>>> The javadoc for the distributions in CM acknowledge that a generator is created by default unless you supply one, and that it is used for sampling. Given the tests are not sampling then null is recommended.
>>>>
>>>> The Junit test code can be updated with a better comment to reflect the recommended usage. Currently it states: “The commons-math distributions are not used for sampling so use a null random generator”. I can change to the CM javadoc of: “In case no sampling is needed for the created distribution, it is advised to pass null as random generator via the appropriate constructors to avoid the additional initialisation overhead.”
>>>>
>>>> I can rename the RandomGenerator to ‘unusedRng’. Anyone who reads the code should not be mislead by this.
>>> I'm sorry for the perpetuation of the misunderstanding.
>>> The CM classes were wrong in initializing a RNG instance even though
>>> it might never be used.  Hence the new API there[1] passes the RNG only
>>> when the user wants to sample.
>>> Passing null to the (deprecated) constructor is a workaround to avoid the
>>> unnecessary creation, as you note but it thus perpetuates bad usage; in
>>> the case of a unit test, documenting proper use is IMO more important than
>>> having a slight performance improvement.
>>> Note that if/when we release [Statisitics], the classes from there (where the
>>> API has been corrected) will be used in the test.
>>>
>>> HTH,
>>> Gilles
>>>
>>> [1] http://commons.apache.org/proper/commons-math/apidocs/src-html/org/apache/commons/math4/distribution/NormalDistribution.html#line.240
>> We seem to have some crossed wires here. I am advocating using the CM3
>> distributions in the recommended way. In that library these constructors
>> are not deprecated. So this is a change for 'proper use' of that
>> library. You are advocating using the constructor as it appears in the
>> improved, but unreleased, CM4 distributions. This is to promote a better
>> designed library that accept only parameters related to the distribution
>> and also avoid a reader wondering why the CM3 constructor was deleted in
>> CM4. I can see the merit in this. However as advocates of commons I
>> believe we should employ the recommended way for the library we are
>> using irrespective of what will happen in the future.
>>
>> Given the scenario that a user reads the test code to understand how the
>> test is checking the samplers do sample correctly from the distribution.
>> Can we change the test code to state that the reference distribution is
>> constructed using CM3. Here the distributions have a dual functionality
>> of computing the PMF/PDF and also performing sampling. The test does not
>> require the sampling functionality and so passes an 'unusedRng' to the
>> constructor. This should not lead any reader astray, promotes correct
>> usage of CM3 and part-way explains why CM4 does not have the constructor
>> (since the distributions now have a separate sampling functionality).
>>
>> In a flip scenario if the original code is restored then a reader would
>> have an example of how to use CM3 for PMF/PDF computations that has a
>> performance hit (that they may not know about). It would be up to them
>> to discover this and then how to avoid this performance hit by reading
>> the documentation. I think this is worse, hence the change.
>>
>> So the lesser of two evils: (1) show a user how to avoid poor
>> performance during usage of CM3 but prompt them to question the library
>> design; (2) show a user how to use a distribution with only the
>> parameters that control the distribution, but leave them with a
>> performance hit to figure out if they copy the code.
>>
>> Thank you for making me clarify my position. If you still disagree then
>> we can restore the old code and put a note that the distributions in
>> future should be from commons statistics/CM4 (or create a Jira ticket to
>> record the intention). I'm happy with either. But in a reversion I would
>> add a note that for clarity the CM3 implementation here is used with
>> only the parameters that control the distribution. Other parameters that
>> affect performance are not employed.
> I can understand what you say; it is a rehash of all the discussions
> we had back then. ;-)
> The (so-called "recommended") null argument was to be a workaround
> for users that could not bear the performance hit.
>
> There is no real need to revert the code as long as it won't entail
> questioning that the design fix, as implemented in [Statisitics], is
> fine, and that the test in [RNG] will use that in due time.
>
> What would be great is to review [Statistics] and make a release
> of it[1], so that we can drop the dependency towards CM v3.6.1 and
> stop the indirect advocacy for an outdated version just because
> CM 4.0 (with tens of bugfixes and enhancements) could never be
> released.
>
> [1] Even if the version number would "0.x" because its scope is much
>      larger than its current contents.

Sorry this went off list in my last reply.

So the current code using the null RandomGenerator stays. I can update 
the test with a better explanation quoting the current Javadoc for the 
distribution, e.g.:

             // This test uses reference distributions from 
commons-math3 to compute the expected
             // PMF. These distributions have a dual functionality to 
compute the PMF and perform
             // sampling. In case no sampling is needed for the created 
distribution, it is advised
             // to pass null as the random generator via the appropriate 
constructors to avoid the
             // additional initialisation overhead.
             org.apache.commons.math3.random.RandomGenerator unusedRng = 
null;

I will put it on my todo list to have a look at [Statistics].

Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Gilles Sadowski <gi...@gmail.com>.
Hi.

Le mer. 13 févr. 2019 à 21:21, Alex Herbert <al...@gmail.com> a écrit :
>
>
>
> > On 13 Feb 2019, at 17:52, Gilles Sadowski <gi...@gmail.com> wrote:
> >
> >> Le mer. 13 févr. 2019 à 18:47, Alex Herbert <al...@gmail.com> a écrit :
> >>
> >>> On 13/02/2019 17:35, Gilles Sadowski wrote:
> >>> Hello.
> >>>
> >>>> Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
> >>>> This is an automated email from the ASF dual-hosted git repository.
> >>>>
> >>>> aherbert pushed a commit to branch master
> >>>> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
> >>>>
> >>>> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
> >>>> Author: aherbert <ah...@apache.org>
> >>>> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
> >>>>
> >>>>     The commons-math distributions can use a null random generator
> >>> Not a good move, I 'd think: this constructor has disappeared from
> >>> the development version of CM.[1]
> >>
> >> The constructor is in the unit tests. These depend on commons-math3 in
> >> the test scope.
> >>
> >> If the tests are upgraded to commons-math4 then this will just be a
> >> compile error. The tests would have to be changed anyway to reference
> >> the updated component package name for maths.
> >
> > I know; the point is that this constructor was a bad design
> > decision (there are old and long discussions about it).
> > So, why present wrong usage in [RNG] (that would a.o. lead
> > to wondering why the constructor was deleted)?
> >
>
> I thought I was changing to the recommended usage.
>
> The javadoc for the distributions in CM acknowledge that a generator is created by default unless you supply one, and that it is used for sampling. Given the tests are not sampling then null is recommended.
>
> The Junit test code can be updated with a better comment to reflect the recommended usage. Currently it states: “The commons-math distributions are not used for sampling so use a null random generator”. I can change to the CM javadoc of: “In case no sampling is needed for the created distribution, it is advised to pass null as random generator via the appropriate constructors to avoid the additional initialisation overhead.”
>
> I can rename the RandomGenerator to ‘unusedRng’. Anyone who reads the code should not be mislead by this.

I'm sorry for the perpetuation of the misunderstanding.
The CM classes were wrong in initializing a RNG instance even though
it might never be used.  Hence the new API there[1] passes the RNG only
when the user wants to sample.
Passing null to the (deprecated) constructor is a workaround to avoid the
unnecessary creation, as you note but it thus perpetuates bad usage; in
the case of a unit test, documenting proper use is IMO more important than
having a slight performance improvement.
Note that if/when we release [Statisitics], the classes from there (where the
API has been corrected) will be used in the test.

HTH,
Gilles

[1] http://commons.apache.org/proper/commons-math/apidocs/src-html/org/apache/commons/math4/distribution/NormalDistribution.html#line.240

>
> > Regards,
> > Gilles
> >
> >>
> >> Alex
> >>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Alex Herbert <al...@gmail.com>.

> On 13 Feb 2019, at 17:52, Gilles Sadowski <gi...@gmail.com> wrote:
> 
>> Le mer. 13 févr. 2019 à 18:47, Alex Herbert <al...@gmail.com> a écrit :
>> 
>>> On 13/02/2019 17:35, Gilles Sadowski wrote:
>>> Hello.
>>> 
>>>> Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
>>>> This is an automated email from the ASF dual-hosted git repository.
>>>> 
>>>> aherbert pushed a commit to branch master
>>>> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
>>>> 
>>>> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
>>>> Author: aherbert <ah...@apache.org>
>>>> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
>>>> 
>>>>     The commons-math distributions can use a null random generator
>>> Not a good move, I 'd think: this constructor has disappeared from
>>> the development version of CM.[1]
>> 
>> The constructor is in the unit tests. These depend on commons-math3 in
>> the test scope.
>> 
>> If the tests are upgraded to commons-math4 then this will just be a
>> compile error. The tests would have to be changed anyway to reference
>> the updated component package name for maths.
> 
> I know; the point is that this constructor was a bad design
> decision (there are old and long discussions about it).
> So, why present wrong usage in [RNG] (that would a.o. lead
> to wondering why the constructor was deleted)?
> 

I thought I was changing to the recommended usage. 

The javadoc for the distributions in CM acknowledge that a generator is created by default unless you supply one, and that it is used for sampling. Given the tests are not sampling then null is recommended. 

The Junit test code can be updated with a better comment to reflect the recommended usage. Currently it states: “The commons-math distributions are not used for sampling so use a null random generator”. I can change to the CM javadoc of: “In case no sampling is needed for the created distribution, it is advised to pass null as random generator via the appropriate constructors to avoid the additional initialisation overhead.”

I can rename the RandomGenerator to ‘unusedRng’. Anyone who reads the code should not be mislead by this.

> Regards,
> Gilles
> 
>> 
>> Alex
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Gilles Sadowski <gi...@gmail.com>.
Le mer. 13 févr. 2019 à 18:47, Alex Herbert <al...@gmail.com> a écrit :
>
> On 13/02/2019 17:35, Gilles Sadowski wrote:
> > Hello.
> >
> > Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> aherbert pushed a commit to branch master
> >> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
> >>
> >> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
> >> Author: aherbert <ah...@apache.org>
> >> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
> >>
> >>      The commons-math distributions can use a null random generator
> > Not a good move, I 'd think: this constructor has disappeared from
> > the development version of CM.[1]
>
> The constructor is in the unit tests. These depend on commons-math3 in
> the test scope.
>
> If the tests are upgraded to commons-math4 then this will just be a
> compile error. The tests would have to be changed anyway to reference
> the updated component package name for maths.

I know; the point is that this constructor was a bad design
decision (there are old and long discussions about it).
So, why present wrong usage in [RNG] (that would a.o. lead
to wondering why the constructor was deleted)?

Regards,
Gilles

>
> Alex
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Alex Herbert <al...@gmail.com>.
On 13/02/2019 17:35, Gilles Sadowski wrote:
> Hello.
>
> Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> aherbert pushed a commit to branch master
>> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
>>
>> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
>> Author: aherbert <ah...@apache.org>
>> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
>>
>>      The commons-math distributions can use a null random generator
> Not a good move, I 'd think: this constructor has disappeared from
> the development version of CM.[1]

The constructor is in the unit tests. These depend on commons-math3 in 
the test scope.

If the tests are upgraded to commons-math4 then this will just be a 
compile error. The tests would have to be changed anyway to reference 
the updated component package name for maths.

Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by Gilles Sadowski <gi...@gmail.com>.
Hello.

Le mer. 13 févr. 2019 à 17:20, <ah...@apache.org> a écrit :
>
> This is an automated email from the ASF dual-hosted git repository.
>
> aherbert pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-rng.git
>
> commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
> Author: aherbert <ah...@apache.org>
> AuthorDate: Wed Feb 13 16:20:21 2019 +0000
>
>     The commons-math distributions can use a null random generator

Not a good move, I 'd think: this constructor has disappeared from
the development version of CM.[1]

Regards,
Gilles

[1] http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/distribution/NormalDistribution.html

> ---
>  .../distribution/ContinuousSamplersList.java       | 74 ++++++++++++----------
>  .../distribution/DiscreteSamplersList.java         | 39 +++++++-----
>  2 files changed, 61 insertions(+), 52 deletions(-)
>
> diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
> index 58a2328..1cf4313 100644
> --- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
> +++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
> @@ -33,172 +33,176 @@ public class ContinuousSamplersList {
>
>      static {
>          try {
> +            // The commons-math distributions are not used for sampling so use a null random generator
> +            org.apache.commons.math3.random.RandomGenerator rng = null;
> +
>              // List of distributions to test.
>
>              // Gaussian ("inverse method").
>              final double meanNormal = -123.45;
>              final double sigmaNormal = 6.789;
> -            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
>                  RandomSource.create(RandomSource.KISS));
>              // Gaussian (DEPRECATED "Box-Muller").
> -            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
>                  new BoxMullerGaussianSampler(RandomSource.create(RandomSource.MT), meanNormal, sigmaNormal));
>              // Gaussian ("Box-Muller").
> -            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
>                  new GaussianSampler(new BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
>                                      meanNormal, sigmaNormal));
>              // Gaussian ("Marsaglia").
> -            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
>                  new GaussianSampler(new MarsagliaNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
>                                      meanNormal, sigmaNormal));
>              // Gaussian ("Ziggurat").
> -            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
>                  new GaussianSampler(new ZigguratNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
>                                      meanNormal, sigmaNormal));
>
>              // Beta ("inverse method").
>              final double alphaBeta = 4.3;
>              final double betaBeta = 2.1;
> -            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBeta, betaBeta),
> +            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBeta, betaBeta),
>                  RandomSource.create(RandomSource.ISAAC));
>              // Beta ("Cheng").
> -            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBeta, betaBeta),
> +            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBeta, betaBeta),
>                  new ChengBetaSampler(RandomSource.create(RandomSource.MWC_256), alphaBeta, betaBeta));
> -            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(betaBeta, alphaBeta),
> +            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, betaBeta, alphaBeta),
>                  new ChengBetaSampler(RandomSource.create(RandomSource.WELL_19937_A), betaBeta, alphaBeta));
>              // Beta ("Cheng", alternate algorithm).
>              final double alphaBetaAlt = 0.5678;
>              final double betaBetaAlt = 0.1234;
> -            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBetaAlt, betaBetaAlt),
> +            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBetaAlt, betaBetaAlt),
>                  new ChengBetaSampler(RandomSource.create(RandomSource.WELL_512_A), alphaBetaAlt, betaBetaAlt));
> -            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(betaBetaAlt, alphaBetaAlt),
> +            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, betaBetaAlt, alphaBetaAlt),
>                  new ChengBetaSampler(RandomSource.create(RandomSource.WELL_19937_C), betaBetaAlt, alphaBetaAlt));
>
>              // Cauchy ("inverse method").
>              final double medianCauchy = 0.123;
>              final double scaleCauchy = 4.5;
> -            add(LIST, new org.apache.commons.math3.distribution.CauchyDistribution(medianCauchy, scaleCauchy),
> +            add(LIST, new org.apache.commons.math3.distribution.CauchyDistribution(rng, medianCauchy, scaleCauchy),
>                  RandomSource.create(RandomSource.WELL_19937_C));
>
>              // Chi-square ("inverse method").
>              final int dofChi2 = 12;
> -            add(LIST, new org.apache.commons.math3.distribution.ChiSquaredDistribution(dofChi2),
> +            add(LIST, new org.apache.commons.math3.distribution.ChiSquaredDistribution(rng, dofChi2),
>                  RandomSource.create(RandomSource.WELL_19937_A));
>
>              // Exponential ("inverse method").
>              final double meanExp = 3.45;
> -            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(meanExp),
> +            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(rng, meanExp),
>                  RandomSource.create(RandomSource.WELL_44497_A));
>              // Exponential.
> -            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(meanExp),
> +            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(rng, meanExp),
>                  new AhrensDieterExponentialSampler(RandomSource.create(RandomSource.MT), meanExp));
>
>              // F ("inverse method").
>              final int numDofF = 4;
>              final int denomDofF = 7;
> -            add(LIST, new org.apache.commons.math3.distribution.FDistribution(numDofF, denomDofF),
> +            add(LIST, new org.apache.commons.math3.distribution.FDistribution(rng, numDofF, denomDofF),
>                  RandomSource.create(RandomSource.MT_64));
>
>              // Gamma ("inverse method").
>              final double thetaGammaSmallerThanOne = 0.1234;
>              final double thetaGammaLargerThanOne = 2.345;
>              final double alphaGamma = 3.456;
> -            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaLargerThanOne, alphaGamma),
> +            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaLargerThanOne, alphaGamma),
>                  RandomSource.create(RandomSource.SPLIT_MIX_64));
>              // Gamma (theta < 1).
> -            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaSmallerThanOne, alphaGamma),
> +            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaSmallerThanOne, alphaGamma),
>                  new AhrensDieterMarsagliaTsangGammaSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S),
>                                                             alphaGamma, thetaGammaSmallerThanOne));
>              // Gamma (theta > 1).
> -            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaLargerThanOne, alphaGamma),
> +            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaLargerThanOne, alphaGamma),
>                  new AhrensDieterMarsagliaTsangGammaSampler(RandomSource.create(RandomSource.WELL_44497_B),
>                                                             alphaGamma, thetaGammaLargerThanOne));
>
>              // Gumbel ("inverse method").
>              final double muGumbel = -4.56;
>              final double betaGumbel = 0.123;
> -            add(LIST, new org.apache.commons.math3.distribution.GumbelDistribution(muGumbel, betaGumbel),
> +            add(LIST, new org.apache.commons.math3.distribution.GumbelDistribution(rng, muGumbel, betaGumbel),
>                  RandomSource.create(RandomSource.WELL_1024_A));
>
>              // Laplace ("inverse method").
>              final double muLaplace = 12.3;
>              final double betaLaplace = 5.6;
> -            add(LIST, new org.apache.commons.math3.distribution.LaplaceDistribution(muLaplace, betaLaplace),
> +            add(LIST, new org.apache.commons.math3.distribution.LaplaceDistribution(rng, muLaplace, betaLaplace),
>                  RandomSource.create(RandomSource.MWC_256));
>
>              // Levy ("inverse method").
>              final double muLevy = -1.098;
>              final double cLevy = 0.76;
> -            add(LIST, new org.apache.commons.math3.distribution.LevyDistribution(muLevy, cLevy),
> +            add(LIST, new org.apache.commons.math3.distribution.LevyDistribution(rng, muLevy, cLevy),
>                  RandomSource.create(RandomSource.TWO_CMRES));
>
>              // Log normal ("inverse method").
>              final double scaleLogNormal = 2.345;
>              final double shapeLogNormal = 0.1234;
> -            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
>                  RandomSource.create(RandomSource.KISS));
>              // Log-normal (DEPRECATED "Box-Muller").
> -            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
>                  new BoxMullerLogNormalSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S), scaleLogNormal, shapeLogNormal));
>              // Log-normal ("Box-Muller").
> -            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
>                  new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S)),
>                                       scaleLogNormal, shapeLogNormal));
>              // Log-normal ("Marsaglia").
> -            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
>                  new LogNormalSampler(new MarsagliaNormalizedGaussianSampler(RandomSource.create(RandomSource.MT_64)),
>                                       scaleLogNormal, shapeLogNormal));
>              // Log-normal ("Ziggurat").
> -            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
> +            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
>                  new LogNormalSampler(new ZigguratNormalizedGaussianSampler(RandomSource.create(RandomSource.MWC_256)),
>                                       scaleLogNormal, shapeLogNormal));
>
>              // Logistic ("inverse method").
>              final double muLogistic = -123.456;
>              final double sLogistic = 7.89;
> -            add(LIST, new org.apache.commons.math3.distribution.LogisticDistribution(muLogistic, sLogistic),
> +            add(LIST, new org.apache.commons.math3.distribution.LogisticDistribution(rng, muLogistic, sLogistic),
>                  RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 2, 6));
>
>              // Nakagami ("inverse method").
>              final double muNakagami = 78.9;
>              final double omegaNakagami = 23.4;
> -            add(LIST, new org.apache.commons.math3.distribution.NakagamiDistribution(muNakagami, omegaNakagami),
> +            final double inverseAbsoluteAccuracyNakagami = org.apache.commons.math3.distribution.NakagamiDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
> +            add(LIST, new org.apache.commons.math3.distribution.NakagamiDistribution(rng, muNakagami, omegaNakagami, inverseAbsoluteAccuracyNakagami),
>                  RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 5, 3));
>
>              // Pareto ("inverse method").
>              final double scalePareto = 23.45;
>              final double shapePareto = 0.1234;
> -            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(scalePareto, shapePareto),
> +            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(rng, scalePareto, shapePareto),
>                  RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 9, 11));
>              // Pareto.
> -            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(scalePareto, shapePareto),
> +            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(rng, scalePareto, shapePareto),
>                  new InverseTransformParetoSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S), scalePareto, shapePareto));
>
>              // T ("inverse method").
>              final double dofT = 0.76543;
> -            add(LIST, new org.apache.commons.math3.distribution.TDistribution(dofT),
> +            add(LIST, new org.apache.commons.math3.distribution.TDistribution(rng, dofT),
>                  RandomSource.create(RandomSource.ISAAC));
>
>              // Triangular ("inverse method").
>              final double aTriangle = -0.76543;
>              final double cTriangle = -0.65432;
>              final double bTriangle = -0.54321;
> -            add(LIST, new org.apache.commons.math3.distribution.TriangularDistribution(aTriangle, cTriangle, bTriangle),
> +            add(LIST, new org.apache.commons.math3.distribution.TriangularDistribution(rng, aTriangle, cTriangle, bTriangle),
>                  RandomSource.create(RandomSource.MT));
>
>              // Uniform ("inverse method").
>              final double loUniform = -1.098;
>              final double hiUniform = 0.76;
> -            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(loUniform, hiUniform),
> +            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(rng, loUniform, hiUniform),
>                  RandomSource.create(RandomSource.TWO_CMRES));
>              // Uniform.
> -            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(loUniform, hiUniform),
> +            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(rng, loUniform, hiUniform),
>                  new ContinuousUniformSampler(RandomSource.create(RandomSource.MT_64), loUniform, hiUniform));
>
>              // Weibull ("inverse method").
>              final double alphaWeibull = 678.9;
>              final double betaWeibull = 98.76;
> -            add(LIST, new org.apache.commons.math3.distribution.WeibullDistribution(alphaWeibull, betaWeibull),
> +            add(LIST, new org.apache.commons.math3.distribution.WeibullDistribution(rng, alphaWeibull, betaWeibull),
>                  RandomSource.create(RandomSource.WELL_44497_B));
>          } catch (Exception e) {
>              System.err.println("Unexpected exception while creating the list of samplers: " + e);
> diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
> index 10da78d..21cd20b 100644
> --- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
> +++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
> @@ -35,18 +35,21 @@ public class DiscreteSamplersList {
>
>      static {
>          try {
> +            // The commons-math distributions are not used for sampling so use a null random generator
> +            org.apache.commons.math3.random.RandomGenerator rng = null;
> +
>              // List of distributions to test.
>
>              // Binomial ("inverse method").
>              final int trialsBinomial = 20;
>              final double probSuccessBinomial = 0.67;
> -            add(LIST, new org.apache.commons.math3.distribution.BinomialDistribution(trialsBinomial, probSuccessBinomial),
> +            add(LIST, new org.apache.commons.math3.distribution.BinomialDistribution(rng, trialsBinomial, probSuccessBinomial),
>                  MathArrays.sequence(8, 9, 1),
>                  RandomSource.create(RandomSource.KISS));
>
>              // Geometric ("inverse method").
>              final double probSuccessGeometric = 0.21;
> -            add(LIST, new org.apache.commons.math3.distribution.GeometricDistribution(probSuccessGeometric),
> +            add(LIST, new org.apache.commons.math3.distribution.GeometricDistribution(rng, probSuccessGeometric),
>                  MathArrays.sequence(10, 0, 1),
>                  RandomSource.create(RandomSource.ISAAC));
>
> @@ -54,80 +57,82 @@ public class DiscreteSamplersList {
>              final int popSizeHyper = 34;
>              final int numSuccessesHyper = 11;
>              final int sampleSizeHyper = 12;
> -            add(LIST, new org.apache.commons.math3.distribution.HypergeometricDistribution(popSizeHyper, numSuccessesHyper, sampleSizeHyper),
> +            add(LIST, new org.apache.commons.math3.distribution.HypergeometricDistribution(rng, popSizeHyper, numSuccessesHyper, sampleSizeHyper),
>                  MathArrays.sequence(10, 0, 1),
>                  RandomSource.create(RandomSource.MT));
>
>              // Pascal ("inverse method").
>              final int numSuccessesPascal = 6;
>              final double probSuccessPascal = 0.2;
> -            add(LIST, new org.apache.commons.math3.distribution.PascalDistribution(numSuccessesPascal, probSuccessPascal),
> +            add(LIST, new org.apache.commons.math3.distribution.PascalDistribution(rng, numSuccessesPascal, probSuccessPascal),
>                  MathArrays.sequence(18, 1, 1),
>                  RandomSource.create(RandomSource.TWO_CMRES));
>
>              // Uniform ("inverse method").
>              final int loUniform = -3;
>              final int hiUniform = 4;
> -            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loUniform, hiUniform),
> +            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loUniform, hiUniform),
>                  MathArrays.sequence(8, -3, 1),
>                  RandomSource.create(RandomSource.SPLIT_MIX_64));
>              // Uniform.
> -            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loUniform, hiUniform),
> +            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loUniform, hiUniform),
>                  MathArrays.sequence(8, -3, 1),
>                  new DiscreteUniformSampler(RandomSource.create(RandomSource.MT_64), loUniform, hiUniform));
>              // Uniform (large range).
>              final int halfMax = Integer.MAX_VALUE / 2;
>              final int hiLargeUniform = halfMax + 10;
>              final int loLargeUniform = -hiLargeUniform;
> -            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loLargeUniform, hiLargeUniform),
> +            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loLargeUniform, hiLargeUniform),
>                  MathArrays.sequence(20, -halfMax, halfMax / 10),
>                  new DiscreteUniformSampler(RandomSource.create(RandomSource.WELL_1024_A), loLargeUniform, hiLargeUniform));
>
>              // Zipf ("inverse method").
>              final int numElementsZipf = 5;
>              final double exponentZipf = 2.345;
> -            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentZipf),
> +            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentZipf),
>                  MathArrays.sequence(5, 1, 1),
>                  RandomSource.create(RandomSource.XOR_SHIFT_1024_S));
>              // Zipf.
> -            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentZipf),
> +            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentZipf),
>                  MathArrays.sequence(5, 1, 1),
>                  new RejectionInversionZipfSampler(RandomSource.create(RandomSource.WELL_19937_C), numElementsZipf, exponentZipf));
>              // Zipf (exponent close to 1).
>              final double exponentCloseToOneZipf = 1 - 1e-10;
> -            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentCloseToOneZipf),
> +            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentCloseToOneZipf),
>                  MathArrays.sequence(5, 1, 1),
>                  new RejectionInversionZipfSampler(RandomSource.create(RandomSource.WELL_19937_C), numElementsZipf, exponentCloseToOneZipf));
>
>              // Poisson ("inverse method").
> +            final double epsilonPoisson = org.apache.commons.math3.distribution.PoissonDistribution.DEFAULT_EPSILON;
> +            final int maxIterationsPoisson = org.apache.commons.math3.distribution.PoissonDistribution.DEFAULT_MAX_ITERATIONS;
>              final double meanPoisson = 3.21;
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(10, 0, 1),
>                  RandomSource.create(RandomSource.MWC_256));
>              // Poisson.
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(10, 0, 1),
>                  new PoissonSampler(RandomSource.create(RandomSource.KISS), meanPoisson));
>              // Dedicated small mean poisson sampler
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(10, 0, 1),
>                  new SmallMeanPoissonSampler(RandomSource.create(RandomSource.KISS), meanPoisson));
>              // Poisson (40 < mean < 80).
>              final double largeMeanPoisson = 67.89;
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(largeMeanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, largeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(50, (int) (largeMeanPoisson - 25), 1),
>                  new PoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), largeMeanPoisson));
>              // Dedicated large mean poisson sampler
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(largeMeanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, largeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(50, (int) (largeMeanPoisson - 25), 1),
>                  new LargeMeanPoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), largeMeanPoisson));
>              // Poisson (mean >> 40).
>              final double veryLargeMeanPoisson = 543.21;
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(veryLargeMeanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, veryLargeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(100, (int) (veryLargeMeanPoisson - 50), 1),
>                  new PoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), veryLargeMeanPoisson));
>              // Dedicated large mean poisson sampler
> -            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(veryLargeMeanPoisson),
> +            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, veryLargeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
>                  MathArrays.sequence(100, (int) (veryLargeMeanPoisson - 50), 1),
>                  new LargeMeanPoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), veryLargeMeanPoisson));
>          } catch (Exception e) {
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[commons-rng] 02/02: The commons-math distributions can use a null random generator

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit 367f022a88dedf2b79778f18ad1ed3ec655fffe8
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Feb 13 16:20:21 2019 +0000

    The commons-math distributions can use a null random generator
---
 .../distribution/ContinuousSamplersList.java       | 74 ++++++++++++----------
 .../distribution/DiscreteSamplersList.java         | 39 +++++++-----
 2 files changed, 61 insertions(+), 52 deletions(-)

diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
index 58a2328..1cf4313 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
@@ -33,172 +33,176 @@ public class ContinuousSamplersList {
 
     static {
         try {
+            // The commons-math distributions are not used for sampling so use a null random generator
+            org.apache.commons.math3.random.RandomGenerator rng = null;
+
             // List of distributions to test.
 
             // Gaussian ("inverse method").
             final double meanNormal = -123.45;
             final double sigmaNormal = 6.789;
-            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
+            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
                 RandomSource.create(RandomSource.KISS));
             // Gaussian (DEPRECATED "Box-Muller").
-            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
+            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
                 new BoxMullerGaussianSampler(RandomSource.create(RandomSource.MT), meanNormal, sigmaNormal));
             // Gaussian ("Box-Muller").
-            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
+            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
                 new GaussianSampler(new BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
                                     meanNormal, sigmaNormal));
             // Gaussian ("Marsaglia").
-            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
+            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
                 new GaussianSampler(new MarsagliaNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
                                     meanNormal, sigmaNormal));
             // Gaussian ("Ziggurat").
-            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(meanNormal, sigmaNormal),
+            add(LIST, new org.apache.commons.math3.distribution.NormalDistribution(rng, meanNormal, sigmaNormal),
                 new GaussianSampler(new ZigguratNormalizedGaussianSampler(RandomSource.create(RandomSource.MT)),
                                     meanNormal, sigmaNormal));
 
             // Beta ("inverse method").
             final double alphaBeta = 4.3;
             final double betaBeta = 2.1;
-            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBeta, betaBeta),
+            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBeta, betaBeta),
                 RandomSource.create(RandomSource.ISAAC));
             // Beta ("Cheng").
-            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBeta, betaBeta),
+            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBeta, betaBeta),
                 new ChengBetaSampler(RandomSource.create(RandomSource.MWC_256), alphaBeta, betaBeta));
-            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(betaBeta, alphaBeta),
+            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, betaBeta, alphaBeta),
                 new ChengBetaSampler(RandomSource.create(RandomSource.WELL_19937_A), betaBeta, alphaBeta));
             // Beta ("Cheng", alternate algorithm).
             final double alphaBetaAlt = 0.5678;
             final double betaBetaAlt = 0.1234;
-            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(alphaBetaAlt, betaBetaAlt),
+            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, alphaBetaAlt, betaBetaAlt),
                 new ChengBetaSampler(RandomSource.create(RandomSource.WELL_512_A), alphaBetaAlt, betaBetaAlt));
-            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(betaBetaAlt, alphaBetaAlt),
+            add(LIST, new org.apache.commons.math3.distribution.BetaDistribution(rng, betaBetaAlt, alphaBetaAlt),
                 new ChengBetaSampler(RandomSource.create(RandomSource.WELL_19937_C), betaBetaAlt, alphaBetaAlt));
 
             // Cauchy ("inverse method").
             final double medianCauchy = 0.123;
             final double scaleCauchy = 4.5;
-            add(LIST, new org.apache.commons.math3.distribution.CauchyDistribution(medianCauchy, scaleCauchy),
+            add(LIST, new org.apache.commons.math3.distribution.CauchyDistribution(rng, medianCauchy, scaleCauchy),
                 RandomSource.create(RandomSource.WELL_19937_C));
 
             // Chi-square ("inverse method").
             final int dofChi2 = 12;
-            add(LIST, new org.apache.commons.math3.distribution.ChiSquaredDistribution(dofChi2),
+            add(LIST, new org.apache.commons.math3.distribution.ChiSquaredDistribution(rng, dofChi2),
                 RandomSource.create(RandomSource.WELL_19937_A));
 
             // Exponential ("inverse method").
             final double meanExp = 3.45;
-            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(meanExp),
+            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(rng, meanExp),
                 RandomSource.create(RandomSource.WELL_44497_A));
             // Exponential.
-            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(meanExp),
+            add(LIST, new org.apache.commons.math3.distribution.ExponentialDistribution(rng, meanExp),
                 new AhrensDieterExponentialSampler(RandomSource.create(RandomSource.MT), meanExp));
 
             // F ("inverse method").
             final int numDofF = 4;
             final int denomDofF = 7;
-            add(LIST, new org.apache.commons.math3.distribution.FDistribution(numDofF, denomDofF),
+            add(LIST, new org.apache.commons.math3.distribution.FDistribution(rng, numDofF, denomDofF),
                 RandomSource.create(RandomSource.MT_64));
 
             // Gamma ("inverse method").
             final double thetaGammaSmallerThanOne = 0.1234;
             final double thetaGammaLargerThanOne = 2.345;
             final double alphaGamma = 3.456;
-            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaLargerThanOne, alphaGamma),
+            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaLargerThanOne, alphaGamma),
                 RandomSource.create(RandomSource.SPLIT_MIX_64));
             // Gamma (theta < 1).
-            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaSmallerThanOne, alphaGamma),
+            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaSmallerThanOne, alphaGamma),
                 new AhrensDieterMarsagliaTsangGammaSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S),
                                                            alphaGamma, thetaGammaSmallerThanOne));
             // Gamma (theta > 1).
-            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(thetaGammaLargerThanOne, alphaGamma),
+            add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(rng, thetaGammaLargerThanOne, alphaGamma),
                 new AhrensDieterMarsagliaTsangGammaSampler(RandomSource.create(RandomSource.WELL_44497_B),
                                                            alphaGamma, thetaGammaLargerThanOne));
 
             // Gumbel ("inverse method").
             final double muGumbel = -4.56;
             final double betaGumbel = 0.123;
-            add(LIST, new org.apache.commons.math3.distribution.GumbelDistribution(muGumbel, betaGumbel),
+            add(LIST, new org.apache.commons.math3.distribution.GumbelDistribution(rng, muGumbel, betaGumbel),
                 RandomSource.create(RandomSource.WELL_1024_A));
 
             // Laplace ("inverse method").
             final double muLaplace = 12.3;
             final double betaLaplace = 5.6;
-            add(LIST, new org.apache.commons.math3.distribution.LaplaceDistribution(muLaplace, betaLaplace),
+            add(LIST, new org.apache.commons.math3.distribution.LaplaceDistribution(rng, muLaplace, betaLaplace),
                 RandomSource.create(RandomSource.MWC_256));
 
             // Levy ("inverse method").
             final double muLevy = -1.098;
             final double cLevy = 0.76;
-            add(LIST, new org.apache.commons.math3.distribution.LevyDistribution(muLevy, cLevy),
+            add(LIST, new org.apache.commons.math3.distribution.LevyDistribution(rng, muLevy, cLevy),
                 RandomSource.create(RandomSource.TWO_CMRES));
 
             // Log normal ("inverse method").
             final double scaleLogNormal = 2.345;
             final double shapeLogNormal = 0.1234;
-            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
                 RandomSource.create(RandomSource.KISS));
             // Log-normal (DEPRECATED "Box-Muller").
-            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
                 new BoxMullerLogNormalSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S), scaleLogNormal, shapeLogNormal));
             // Log-normal ("Box-Muller").
-            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
                 new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S)),
                                      scaleLogNormal, shapeLogNormal));
             // Log-normal ("Marsaglia").
-            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
                 new LogNormalSampler(new MarsagliaNormalizedGaussianSampler(RandomSource.create(RandomSource.MT_64)),
                                      scaleLogNormal, shapeLogNormal));
             // Log-normal ("Ziggurat").
-            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+            add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(rng, scaleLogNormal, shapeLogNormal),
                 new LogNormalSampler(new ZigguratNormalizedGaussianSampler(RandomSource.create(RandomSource.MWC_256)),
                                      scaleLogNormal, shapeLogNormal));
 
             // Logistic ("inverse method").
             final double muLogistic = -123.456;
             final double sLogistic = 7.89;
-            add(LIST, new org.apache.commons.math3.distribution.LogisticDistribution(muLogistic, sLogistic),
+            add(LIST, new org.apache.commons.math3.distribution.LogisticDistribution(rng, muLogistic, sLogistic),
                 RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 2, 6));
 
             // Nakagami ("inverse method").
             final double muNakagami = 78.9;
             final double omegaNakagami = 23.4;
-            add(LIST, new org.apache.commons.math3.distribution.NakagamiDistribution(muNakagami, omegaNakagami),
+            final double inverseAbsoluteAccuracyNakagami = org.apache.commons.math3.distribution.NakagamiDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
+            add(LIST, new org.apache.commons.math3.distribution.NakagamiDistribution(rng, muNakagami, omegaNakagami, inverseAbsoluteAccuracyNakagami),
                 RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 5, 3));
 
             // Pareto ("inverse method").
             final double scalePareto = 23.45;
             final double shapePareto = 0.1234;
-            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(scalePareto, shapePareto),
+            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(rng, scalePareto, shapePareto),
                 RandomSource.create(RandomSource.TWO_CMRES_SELECT, null, 9, 11));
             // Pareto.
-            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(scalePareto, shapePareto),
+            add(LIST, new org.apache.commons.math3.distribution.ParetoDistribution(rng, scalePareto, shapePareto),
                 new InverseTransformParetoSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S), scalePareto, shapePareto));
 
             // T ("inverse method").
             final double dofT = 0.76543;
-            add(LIST, new org.apache.commons.math3.distribution.TDistribution(dofT),
+            add(LIST, new org.apache.commons.math3.distribution.TDistribution(rng, dofT),
                 RandomSource.create(RandomSource.ISAAC));
 
             // Triangular ("inverse method").
             final double aTriangle = -0.76543;
             final double cTriangle = -0.65432;
             final double bTriangle = -0.54321;
-            add(LIST, new org.apache.commons.math3.distribution.TriangularDistribution(aTriangle, cTriangle, bTriangle),
+            add(LIST, new org.apache.commons.math3.distribution.TriangularDistribution(rng, aTriangle, cTriangle, bTriangle),
                 RandomSource.create(RandomSource.MT));
 
             // Uniform ("inverse method").
             final double loUniform = -1.098;
             final double hiUniform = 0.76;
-            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(loUniform, hiUniform),
+            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(rng, loUniform, hiUniform),
                 RandomSource.create(RandomSource.TWO_CMRES));
             // Uniform.
-            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(loUniform, hiUniform),
+            add(LIST, new org.apache.commons.math3.distribution.UniformRealDistribution(rng, loUniform, hiUniform),
                 new ContinuousUniformSampler(RandomSource.create(RandomSource.MT_64), loUniform, hiUniform));
 
             // Weibull ("inverse method").
             final double alphaWeibull = 678.9;
             final double betaWeibull = 98.76;
-            add(LIST, new org.apache.commons.math3.distribution.WeibullDistribution(alphaWeibull, betaWeibull),
+            add(LIST, new org.apache.commons.math3.distribution.WeibullDistribution(rng, alphaWeibull, betaWeibull),
                 RandomSource.create(RandomSource.WELL_44497_B));
         } catch (Exception e) {
             System.err.println("Unexpected exception while creating the list of samplers: " + e);
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
index 10da78d..21cd20b 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
@@ -35,18 +35,21 @@ public class DiscreteSamplersList {
 
     static {
         try {
+            // The commons-math distributions are not used for sampling so use a null random generator
+            org.apache.commons.math3.random.RandomGenerator rng = null;
+
             // List of distributions to test.
 
             // Binomial ("inverse method").
             final int trialsBinomial = 20;
             final double probSuccessBinomial = 0.67;
-            add(LIST, new org.apache.commons.math3.distribution.BinomialDistribution(trialsBinomial, probSuccessBinomial),
+            add(LIST, new org.apache.commons.math3.distribution.BinomialDistribution(rng, trialsBinomial, probSuccessBinomial),
                 MathArrays.sequence(8, 9, 1),
                 RandomSource.create(RandomSource.KISS));
 
             // Geometric ("inverse method").
             final double probSuccessGeometric = 0.21;
-            add(LIST, new org.apache.commons.math3.distribution.GeometricDistribution(probSuccessGeometric),
+            add(LIST, new org.apache.commons.math3.distribution.GeometricDistribution(rng, probSuccessGeometric),
                 MathArrays.sequence(10, 0, 1),
                 RandomSource.create(RandomSource.ISAAC));
 
@@ -54,80 +57,82 @@ public class DiscreteSamplersList {
             final int popSizeHyper = 34;
             final int numSuccessesHyper = 11;
             final int sampleSizeHyper = 12;
-            add(LIST, new org.apache.commons.math3.distribution.HypergeometricDistribution(popSizeHyper, numSuccessesHyper, sampleSizeHyper),
+            add(LIST, new org.apache.commons.math3.distribution.HypergeometricDistribution(rng, popSizeHyper, numSuccessesHyper, sampleSizeHyper),
                 MathArrays.sequence(10, 0, 1),
                 RandomSource.create(RandomSource.MT));
 
             // Pascal ("inverse method").
             final int numSuccessesPascal = 6;
             final double probSuccessPascal = 0.2;
-            add(LIST, new org.apache.commons.math3.distribution.PascalDistribution(numSuccessesPascal, probSuccessPascal),
+            add(LIST, new org.apache.commons.math3.distribution.PascalDistribution(rng, numSuccessesPascal, probSuccessPascal),
                 MathArrays.sequence(18, 1, 1),
                 RandomSource.create(RandomSource.TWO_CMRES));
 
             // Uniform ("inverse method").
             final int loUniform = -3;
             final int hiUniform = 4;
-            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loUniform, hiUniform),
+            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loUniform, hiUniform),
                 MathArrays.sequence(8, -3, 1),
                 RandomSource.create(RandomSource.SPLIT_MIX_64));
             // Uniform.
-            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loUniform, hiUniform),
+            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loUniform, hiUniform),
                 MathArrays.sequence(8, -3, 1),
                 new DiscreteUniformSampler(RandomSource.create(RandomSource.MT_64), loUniform, hiUniform));
             // Uniform (large range).
             final int halfMax = Integer.MAX_VALUE / 2;
             final int hiLargeUniform = halfMax + 10;
             final int loLargeUniform = -hiLargeUniform;
-            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(loLargeUniform, hiLargeUniform),
+            add(LIST, new org.apache.commons.math3.distribution.UniformIntegerDistribution(rng, loLargeUniform, hiLargeUniform),
                 MathArrays.sequence(20, -halfMax, halfMax / 10),
                 new DiscreteUniformSampler(RandomSource.create(RandomSource.WELL_1024_A), loLargeUniform, hiLargeUniform));
 
             // Zipf ("inverse method").
             final int numElementsZipf = 5;
             final double exponentZipf = 2.345;
-            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentZipf),
+            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentZipf),
                 MathArrays.sequence(5, 1, 1),
                 RandomSource.create(RandomSource.XOR_SHIFT_1024_S));
             // Zipf.
-            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentZipf),
+            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentZipf),
                 MathArrays.sequence(5, 1, 1),
                 new RejectionInversionZipfSampler(RandomSource.create(RandomSource.WELL_19937_C), numElementsZipf, exponentZipf));
             // Zipf (exponent close to 1).
             final double exponentCloseToOneZipf = 1 - 1e-10;
-            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(numElementsZipf, exponentCloseToOneZipf),
+            add(LIST, new org.apache.commons.math3.distribution.ZipfDistribution(rng, numElementsZipf, exponentCloseToOneZipf),
                 MathArrays.sequence(5, 1, 1),
                 new RejectionInversionZipfSampler(RandomSource.create(RandomSource.WELL_19937_C), numElementsZipf, exponentCloseToOneZipf));
 
             // Poisson ("inverse method").
+            final double epsilonPoisson = org.apache.commons.math3.distribution.PoissonDistribution.DEFAULT_EPSILON;
+            final int maxIterationsPoisson = org.apache.commons.math3.distribution.PoissonDistribution.DEFAULT_MAX_ITERATIONS;
             final double meanPoisson = 3.21;
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(10, 0, 1),
                 RandomSource.create(RandomSource.MWC_256));
             // Poisson.
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(10, 0, 1),
                 new PoissonSampler(RandomSource.create(RandomSource.KISS), meanPoisson));
             // Dedicated small mean poisson sampler
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(meanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, meanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(10, 0, 1),
                 new SmallMeanPoissonSampler(RandomSource.create(RandomSource.KISS), meanPoisson));
             // Poisson (40 < mean < 80).
             final double largeMeanPoisson = 67.89;
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(largeMeanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, largeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(50, (int) (largeMeanPoisson - 25), 1),
                 new PoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), largeMeanPoisson));
             // Dedicated large mean poisson sampler
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(largeMeanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, largeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(50, (int) (largeMeanPoisson - 25), 1),
                 new LargeMeanPoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), largeMeanPoisson));
             // Poisson (mean >> 40).
             final double veryLargeMeanPoisson = 543.21;
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(veryLargeMeanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, veryLargeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(100, (int) (veryLargeMeanPoisson - 50), 1),
                 new PoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), veryLargeMeanPoisson));
             // Dedicated large mean poisson sampler
-            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(veryLargeMeanPoisson),
+            add(LIST, new org.apache.commons.math3.distribution.PoissonDistribution(rng, veryLargeMeanPoisson, epsilonPoisson, maxIterationsPoisson),
                 MathArrays.sequence(100, (int) (veryLargeMeanPoisson - 50), 1),
                 new LargeMeanPoissonSampler(RandomSource.create(RandomSource.SPLIT_MIX_64), veryLargeMeanPoisson));
         } catch (Exception e) {


[commons-rng] 01/02: Remove trailing whitespace

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit 3c4c9d27f834808d5fcc3959fa5da70abf190cd3
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Feb 13 16:00:10 2019 +0000

    Remove trailing whitespace
---
 commons-rng-client-api/src/site/site.xml           |  2 +-
 commons-rng-client-api/src/site/xdoc/index.xml     |  2 +-
 commons-rng-core/src/site/site.xml                 |  2 +-
 commons-rng-core/src/site/xdoc/index.xml           |  2 +-
 .../rng/core/source64/MersenneTwister64Test.java   |  4 ++--
 .../sampling/UniformSamplingVisualCheck.java       |  2 +-
 commons-rng-sampling/src/site/site.xml             |  2 +-
 commons-rng-sampling/src/site/xdoc/index.xml       |  2 +-
 .../distribution/ContinuousSamplersList.java       |  2 +-
 .../DiscreteSamplerParametricTest.java             |  2 +-
 .../distribution/DiscreteSamplersList.java         |  2 +-
 commons-rng-simple/src/site/site.xml               |  2 +-
 commons-rng-simple/src/site/xdoc/index.xml         |  2 +-
 .../rng/simple/internal/SeedFactoryTest.java       |  2 +-
 src/changes/changes.xml                            |  2 +-
 src/site/site.xml                                  |  6 ++---
 src/site/xdoc/developers.xml                       | 28 +++++++++++-----------
 src/site/xdoc/index.xml                            |  2 +-
 src/site/xdoc/userguide/index.xml                  |  8 +++----
 19 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/commons-rng-client-api/src/site/site.xml b/commons-rng-client-api/src/site/site.xml
index ceb6307..44bde7a 100644
--- a/commons-rng-client-api/src/site/site.xml
+++ b/commons-rng-client-api/src/site/site.xml
@@ -34,6 +34,6 @@
       <item name="Javadoc (1.0 release)"
             href="http://commons.apache.org/rng/commons-rng-client-api/javadocs/api-1.0/index.html"/>
     </menu>
-    
+
   </body>
 </project>
diff --git a/commons-rng-client-api/src/site/xdoc/index.xml b/commons-rng-client-api/src/site/xdoc/index.xml
index 49bb584..7a30c6d 100644
--- a/commons-rng-client-api/src/site/xdoc/index.xml
+++ b/commons-rng-client-api/src/site/xdoc/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
 
   <properties>
diff --git a/commons-rng-core/src/site/site.xml b/commons-rng-core/src/site/site.xml
index 9a05373..d5372bb 100644
--- a/commons-rng-core/src/site/site.xml
+++ b/commons-rng-core/src/site/site.xml
@@ -34,6 +34,6 @@
       <item name="Javadoc (1.0 release)"
             href="http://commons.apache.org/rng/commons-rng-core/javadocs/api-1.0/index.html"/>
     </menu>
-    
+
   </body>
 </project>
diff --git a/commons-rng-core/src/site/xdoc/index.xml b/commons-rng-core/src/site/xdoc/index.xml
index 1600b22..f2fd112 100644
--- a/commons-rng-core/src/site/xdoc/index.xml
+++ b/commons-rng-core/src/site/xdoc/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
 
   <properties>
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/MersenneTwister64Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/MersenneTwister64Test.java
index cc2d4e5..73ad428 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/MersenneTwister64Test.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/MersenneTwister64Test.java
@@ -34,7 +34,7 @@ public class MersenneTwister64Test {
                 0x43a38212350ee392L, 0xce77502bffcacf8bL, 0x5d8a82d90126f0e7L, 0xc0510c6f402c1e3cL,
                 0x48d895bf8b69f77bL, 0x8d9fbb371f1de07fL, 0x1126b97be8c91ce2L, 0xf05e1c9dc2674be2L,
                 0xe4d5327a12874c1eL, 0x7c1951ea43a7500dL, 0xbba2bbfbecbc239aL, 0xc5704350b17f0215L,
-                0x823a67c5f88337e7L, 0xd9bf140bfeb4c1a9L, 0x9fbe3cfcd1f08059L, 0xdc29309412e352b9L, 
+                0x823a67c5f88337e7L, 0xd9bf140bfeb4c1a9L, 0x9fbe3cfcd1f08059L, 0xdc29309412e352b9L,
                 0x5a0ff7908b1b3c57L, 0x46f39cb43b126c55L, 0x9648168491f3b126L, 0xdd3e72538fd39a1cL,
                 0xd65a3663fc9b0898L, 0x421ee7823c2af2ebL, 0xcba3a4b69b6ed152L, 0x0348399b7d2b8428L,
                 0xbdb750bf00c34a38L, 0xcf36d95eae514f52L, 0x7b9231d5308d7534L, 0xb225e28cfc5aa663L,
@@ -279,7 +279,7 @@ public class MersenneTwister64Test {
                 0xad268fb5b1105028L, 0xa480149a0dcbc5f4L, 0xb0e8d69c8b15c864L, 0x6ed49c46f19bb8eaL,
                 0x7f1871fdf321818dL, 0x1ec5816f5a9843eaL, 0x77c8da91b5313675L, 0x4cdb66ad515e0717L,
                 0x2ec4712b0bfdfcd6L, 0x6c6f5767fff27330L, 0x071083b972d80c0cL, 0x8d8325e82c4fdcdcL,
-                0xb47a658dad8e13a4L, 0x88710bf005fda027L, 0x69bd3edaf7111200L, 0x0dccdd0c65c810ffL, 
+                0xb47a658dad8e13a4L, 0x88710bf005fda027L, 0x69bd3edaf7111200L, 0x0dccdd0c65c810ffL,
         };
 
         RandomAssert.assertEquals(expectedSequence, rng);
diff --git a/commons-rng-examples/examples-sampling/src/main/java/org/apache/commons/rng/examples/sampling/UniformSamplingVisualCheck.java b/commons-rng-examples/examples-sampling/src/main/java/org/apache/commons/rng/examples/sampling/UniformSamplingVisualCheck.java
index b7c901c..e102221 100644
--- a/commons-rng-examples/examples-sampling/src/main/java/org/apache/commons/rng/examples/sampling/UniformSamplingVisualCheck.java
+++ b/commons-rng-examples/examples-sampling/src/main/java/org/apache/commons/rng/examples/sampling/UniformSamplingVisualCheck.java
@@ -26,7 +26,7 @@ import org.apache.commons.rng.sampling.distribution.ContinuousSampler;
 
 /**
  * Creates 2D plot of sampling output.
- * It is a "manual" check that could help ensure that no artefacts 
+ * It is a "manual" check that could help ensure that no artefacts
  * exist in some tiny region of the expected range, due to loss of
  * accuracy, e.g. when porting C code based on 32-bits "float" to
  * "Commons RNG" that uses Java "double" (64-bits).
diff --git a/commons-rng-sampling/src/site/site.xml b/commons-rng-sampling/src/site/site.xml
index 2d5321b..0599a08 100644
--- a/commons-rng-sampling/src/site/site.xml
+++ b/commons-rng-sampling/src/site/site.xml
@@ -34,6 +34,6 @@
       <item name="Javadoc (1.0 release)"
             href="http://commons.apache.org/rng/commons-rng-sampling/javadocs/api-1.0/index.html"/>
     </menu>
-    
+
   </body>
 </project>
diff --git a/commons-rng-sampling/src/site/xdoc/index.xml b/commons-rng-sampling/src/site/xdoc/index.xml
index f53aab2..52f27ac 100644
--- a/commons-rng-sampling/src/site/xdoc/index.xml
+++ b/commons-rng-sampling/src/site/xdoc/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
 
   <properties>
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
index 991b408..58a2328 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
@@ -260,7 +260,7 @@ public class ContinuousSamplersList {
 
     /**
      * @param dist Distribution.
-     * @return the deciles of the given distribution. 
+     * @return the deciles of the given distribution.
      */
     private static double[] getDeciles(org.apache.commons.math3.distribution.RealDistribution dist) {
         final int last = 9;
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplerParametricTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplerParametricTest.java
index 19f4526..d958be4 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplerParametricTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplerParametricTest.java
@@ -55,7 +55,7 @@ public class DiscreteSamplerParametricTest {
         final int sampleSize = 10000;
 
         final double[] prob = sampler.getProbabilities();
-        final int len = prob.length; 
+        final int len = prob.length;
         final double[] expected = new double[len];
         for (int i = 0; i < len; i++) {
             expected[i] = prob[i] * sampleSize;
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
index 23122c7..10da78d 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
@@ -197,7 +197,7 @@ public class DiscreteSamplersList {
     /**
      * @param dist Distribution.
      * @param points Points.
-     * @return the probabilities of the given points according to the distribution. 
+     * @return the probabilities of the given points according to the distribution.
      */
     private static double[] getProbabilities(org.apache.commons.math3.distribution.IntegerDistribution dist,
                                              int[] points) {
diff --git a/commons-rng-simple/src/site/site.xml b/commons-rng-simple/src/site/site.xml
index c841d71..08a818a 100644
--- a/commons-rng-simple/src/site/site.xml
+++ b/commons-rng-simple/src/site/site.xml
@@ -34,6 +34,6 @@
       <item name="Javadoc (1.0 release)"
             href="http://commons.apache.org/rng/commons-rng-simple/javadocs/api-1.0/index.html"/>
     </menu>
-    
+
   </body>
 </project>
diff --git a/commons-rng-simple/src/site/xdoc/index.xml b/commons-rng-simple/src/site/xdoc/index.xml
index 6b4a355..88f0128 100644
--- a/commons-rng-simple/src/site/xdoc/index.xml
+++ b/commons-rng-simple/src/site/xdoc/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
 
   <properties>
diff --git a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/SeedFactoryTest.java b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/SeedFactoryTest.java
index b34714a..d9ecc4d 100644
--- a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/SeedFactoryTest.java
+++ b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/SeedFactoryTest.java
@@ -72,7 +72,7 @@ public class SeedFactoryTest {
 
         for (int i = 0; i < 50000; i++) {
             final int[] a = SeedFactory.createIntArray(2);
-            final long v = NumberFactory.makeLong(a[0], a[1]); 
+            final long v = NumberFactory.makeLong(a[0], a[1]);
             Integer count = values.get(v);
             if (count == null) {
                 count = 0;
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index df2b05b..2610b5b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -36,7 +36,7 @@ The <action> type attribute can be add,update,fix,remove.
 -->
 
 <!-- NOTE:
-The description attribute entries below are specially formatted 
+The description attribute entries below are specially formatted
 so as to improve the layout of the generated text release notes.
 
 The parsing process removes all line feeds, replacing them with a single space.
diff --git a/src/site/site.xml b/src/site/site.xml
index 8e70cdf..14082e6 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -27,18 +27,18 @@
       <item name="Overview" href="/index.html"/>
       <item name="Downloads" href="http://commons.apache.org/rng/download_rng.cgi"/>
       <item name="Issue Tracking" href="/issue-tracking.html"/>
-      <item name="Source Repository (current)" 
+      <item name="Source Repository (current)"
          href="http://gitbox.apache.org/repos/asf/commons-rng.git"/>
       <!-- <item name="Wiki"   -->
       <!--       href="http://wiki.apache.org/commons/RNG"/> -->
       <item name="Developers Guide" href="/developers.html"/>
       <item name="Release History" href="/release-history.html" />
     </menu>
-    
+
     <menu name="User Guide">
       <item name="Contents" href="/userguide/index.html"/>
     </menu>
-    
+
     <head>
       <![CDATA[<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
       </script>]]>
diff --git a/src/site/xdoc/developers.xml b/src/site/xdoc/developers.xml
index 7b91817..b21149d 100644
--- a/src/site/xdoc/developers.xml
+++ b/src/site/xdoc/developers.xml
@@ -15,12 +15,12 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
   <properties>
     <title>Developers Guide</title>
   </properties>
-  
+
   <body>
 
     <section name="Aims">
@@ -30,7 +30,7 @@
         to ensure that the code they create can be successfully maintained by others.
       </p>
     </section>
-    
+
     <section name='Guidelines'>
       <p>
         Developers are asked to comply with the following development guidelines.
@@ -55,8 +55,8 @@
             </li>
             <li>
               Like most commons components, Commons RNG uses Apache Maven as our
-              build tool. The sources can also be built using Ant (a working 
-              Ant build.xml is included in the top level project directory). 
+              build tool. The sources can also be built using Ant (a working
+              Ant build.xml is included in the top level project directory).
               To build Commons RNG using Maven, you can follow the instructions for
               <a href="http://maven.apache.org/run-maven/index.html">Building a
               project with Maven</a>.
@@ -73,7 +73,7 @@
               RNG Wish List Wiki Page.</a>
             </li>
             <li>
-              Be sure to join the commons-dev and commons-user 
+              Be sure to join the commons-dev and commons-user
               <a href="mail-lists.html">
                 email lists</a> and use them appropriately (make sure the string
                 "[RNG]" starts the Subject line of all your postings).
@@ -84,11 +84,11 @@
                 Setup an account on JIRA
               </a>
               and use it to submit patches and
-              identify bugs. Read the 
+              identify bugs. Read the
               <a href="http://issues.apache.org/bugwritinghelp.html">
               directions</a>
               for submitting bugs and search the database to
-              determine if an issue exists or has already been dealt with.        
+              determine if an issue exists or has already been dealt with.
               <p>
                 See the <a href="http://commons.apache.org/rng/issue-tracking.html">
                 Commons RNG Issue Tracking Page</a>
@@ -110,7 +110,7 @@
         <p>
           Follow the steps below when making suggestions for additions or
           enhancements to Commons RNG. This will make it easier for the community
-          to comment on your ideas and for the committers to keep track of them. 
+          to comment on your ideas and for the committers to keep track of them.
           Thanks in advance!
           <ol>
             <li>Start with a post to the commons-dev mailing list, with [RNG] at
@@ -128,7 +128,7 @@
               useful</li>
             </ul></li>
             <li>Assuming a generally favorable response to the idea on commons-dev,
-            the next step is to add an entry to the 
+            the next step is to add an entry to the
             <a href="http://wiki.apache.org/commons/RngWishList">RNG Wish
             List</a> corresponding to the idea.  Include a reference to the
             discussion thread. </li>
@@ -145,7 +145,7 @@
             ticket if a patch goes more than a few days with no comment or commit.
             </li>
           </ol>
-        </p>   
+        </p>
       </subsection>
 
       <subsection name='Coding Style'>
@@ -206,7 +206,7 @@
           </li>
           <li>
             Implementations <i>should</i> use standard algorithms and
-            references or full descriptions of all algorithms <i>should</i> be 
+            references or full descriptions of all algorithms <i>should</i> be
             provided.
           </li>
           <li>
@@ -251,7 +251,7 @@
             License in a comment that begins the file.
           </li>
           <li>
-            All contributions must comply with the terms of the Apache 
+            All contributions must comply with the terms of the Apache
             <a href="http://www.apache.org/licenses/cla.pdf">Contributor License
             Agreement (CLA)</a>.
           </li>
@@ -265,7 +265,7 @@
           <li>
             References to source materials covered by restrictive proprietary
             licenses should be avoided.  In particular, contributions should not
-            implement or include references to algorithms in 
+            implement or include references to algorithms in
             <a href="http://www.nr.com/">Numerical Recipes (NR)</a>.
             Any questions about copyright or patent issues should be raised on
             the commons-dev mailing list before contributing or committing code.
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 5a0df28..4591c97 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <document>
 
   <properties>
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml
index ef0f9be..dfa417e 100644
--- a/src/site/xdoc/userguide/index.xml
+++ b/src/site/xdoc/userguide/index.xml
@@ -16,7 +16,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-  
+
 <?xml-stylesheet type="text/xsl" href="./xdoc.xsl"?>
 <document url="index.html">
   <properties>
@@ -25,7 +25,7 @@
 
   <body>
     <section name="Table of Contents" href="toc">
-        
+
       <ul>
 
         <li>
@@ -55,7 +55,7 @@
       </ul>
 
     </section>
-    
+
   </body>
-  
+
 </document>