top of page

Squares RNG

                    to download squaresrngv8.zip (version 8 - Feb 4, 2024)

Version 8 contains an improved more efficient keys utility.  The same keys are produced but processing is faster.  See below for previous versions of the RNG.

Squares RNG is a counter-based version of Middle-Square Weyl Sequence RNG.  Counter-based RNGs have no state and are well suited to parallel processing.  Since there are no memory references to a state, counter-based RNGs can be faster than a conventional RNG with a state.

This may be the fastest counter-based RNG that passes BigCrush and PractRand.

Recommended usage:  Instead of placing squares in a library, it is suggested to #include "squares.h" wherever random data is needed. This prevents unnecessary subroutine linkage and will allow inline and optimization to take place.  There is no state to initialize.  However, one does need to choose the counters that are used.  In parallel applications, one might use the processor number for this purpose.

 

Squares RNG is available (free, but without warranty) as open-source software under the GNU General Public License.

Previous software releases are shown below.  The latest version is available above.

                    to download squaresrngv7.zip (version 7 - Mar 15, 2022)

                    to download squaresrngv2.zip (version 2 - Nov 23, 2020)

                    to download squaresrngv3.zip (version 3 - Apr 4, 2021)

                    to download squaresrngv4.zip (version 4 - Oct 4, 2021)

                    to download squaresrngv5.zip (version 5 - Oct 25, 2021)

                    to download squaresrngv6.zip (version 6 - Feb 1, 2022)

                    to download squaresrng.zip     (version1 -  May 4, 2020)

bottom of page