commit | ab6050d992dd9e8057e0d3e3e29d534839c51440 | [log] [tgz] |
---|---|---|
author | aherbert <aherbert@apache.org> | Fri Apr 01 17:46:12 2022 +0100 |
committer | aherbert <aherbert@apache.org> | Tue Apr 05 16:09:41 2022 +0100 |
tree | 4e42a64b819d8ef6185d762db6b458f291c6dc9b | |
parent | 950febd53cad79ee3933bc4b3b57dc38b4a6a998 [diff] |
RNG-174: Improve support for non-zero seeds Allow specification of a range for array seeds that must be non-zero. The values for the range are based on the result of o.a.c.rng.simple.ProvidersCommonParametricTest.testZeroIntArraySeed. See also the core module for tests using: - RandomAssert.assertNextIntZeroOutput - RandomAssert.assertIntArrayConstructorWithSingleBitInPoolIsFunctional Any generator that fails these tests requires a non-zero seed. In most cases this was set as the full seed length, or one less for generators that do not use all the bits of the seed array (WELL_19937_x, WELL_44497_x). Notable exceptions: The KISS generator is reduced to a simple LCG when positions [0, 3) are all zero. Added a test to demonstrate this. With a zero seed the KISS LCG passes testZeroIntArraySeed. To avoid a poor generator the seed will be checked to be non-zero in [0, 3). The MSWS generator is sensitive to the initial state. Added a test to show that a zero seed creates zero output. Updating RandomAssert to add an assertLongArrayConstructorWithSingleBitInPoolIsFunctional test shows the MSWS fails with single bit seeds. The sub-range has been set to [2, 3) to ensure a non-zero Weyl increment which is the best way to escape a bad seed. This is a functionally breaking change.
The Apache Commons RNG project provides pure-Java implementation of pseudo-random generators.
More information can be found on the Apache Commons RNG homepage. The Javadoc for each of the modules can be browsed:
Questions related to the usage of Apache Commons RNG should be posted to the user mailing list.
You can download source and binaries from our download page.
Alternatively you can pull it from the central Maven repositories, e.g.:
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-rng-simple</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-rng-sampling</artifactId> <version>1.4</version> </dependency>
We accept Pull Requests via GitHub. The developer mailing list is the main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us:
mvn clean test
.If you plan to contribute on a regular basis, please consider filing a contributor license agreement. You can learn more about contributing via GitHub in our contribution guidelines.
This code is under the Apache Licence v2.
See the NOTICE
file for required notices and attributions.
You like Apache Commons RNG? Then donate back to the ASF to support the development.
#apache-commons
IRC channel on irc.freenode.org