Skip to content

Commit c01b7b7

Browse files
authored
Merge pull request #293 from schmouk/dev
Dev --> Master
2 parents fef7cfb + 5acf94e commit c01b7b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+254
-212
lines changed

Python3.10/PyRandLib/basecwg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ class BaseCWG( BaseRandom ):
4747
implemented version. See implementation classes to get their formal
4848
description.
4949
50-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period CW-Generator
50+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5151
with low computation time, medium period, 64- bits output values and very
5252
good randomness characteristics.
5353
54-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period CW-Generator
54+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5555
with very low computation time, medium period, 64-bits output values and
5656
very good randomness characteristics.
5757
58-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period CW-generator
58+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period CW-generator
5959
with very low computation time, medium period, 64- bits output values and
6060
very good randomness characteristics.
6161
@@ -71,9 +71,9 @@ class BaseCWG( BaseRandom ):
7171
7272
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7373
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
74-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
75-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
76-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
74+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
75+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
76+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
7777
7878
* _small crush_ is a small set of simple tests that quickly tests some of
7979
the expected characteristics for a pretty good PRNG;

Python3.10/PyRandLib/baserandom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class BaseRandom( Random ):
3434
3535
Copyright (c) 2016-2025 Philippe Schmouker
3636
37-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period Collatz-Weyl Generator
37+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period Collatz-Weyl Generator
3838
with low computation time, medium period, 64- bits output values and very good
3939
randomness characteristics.
40-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period C-W Generator with
40+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period C-W Generator with
4141
with very low computation time, medium period, 64-bits output values and very
4242
good randomness characteristics.
43-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period C-W generator with
43+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period C-W generator with
4444
very low computation time, medium period, 64- bits output values and very good
4545
randomness characteristics.
4646

Python3.10/PyRandLib/cwg128.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Cwg128( BaseCWG ):
3333
"""
3434
Pseudo-random numbers generator - Collatz-Weyl pseudo-random Generators
3535
dedicated to 128-bits calculations and 128-bits output values with large
36-
period (min 2^135, i.e. 4.36e+40) but short computation time. All CWG
36+
period (min 2^128, i.e. 6.81e+38) but short computation time. All CWG
3737
algorithms offer multi streams features, by simply using different initial
3838
settings for control value 's' - see below.
3939
@@ -56,11 +56,11 @@ class Cwg128( BaseCWG ):
5656
It appears that these value are used just are 's' for c[0], 'x' for c[1],
5757
'a' for c[2] and 'weyl' for c[3] in the other versions of the algorithm.
5858
59-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period CW-Generator
59+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
6060
with very low computation time, medium period, 64- bits output values and
6161
very good randomness characteristics.
6262
63-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period CW-Generator
63+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
6464
with very low computation time, medium period, 64-bits output values and
6565
very good randomness characteristics.
6666
@@ -76,9 +76,9 @@ class Cwg128( BaseCWG ):
7676
7777
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7878
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
79-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
80-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
81-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
79+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
80+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
81+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
8282
8383
* _small crush_ is a small set of simple tests that quickly tests some of
8484
the expected characteristics for a pretty good PRNG;

Python3.10/PyRandLib/cwg128_64.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Cwg128_64( BaseCWG ):
3333
"""
3434
Pseudo-random numbers generator - Collatz-Weyl pseudorandom Generator
3535
dedicated to 128-bits calculations and 64-bits output values with small
36-
period (min 2^71, i.e. 2.36e+21) but short computation time. All CWG
36+
period (min 2^64, i.e. 1.84e+19) but short computation time. All CWG
3737
algorithms offer multi streams features, by simply using different initial
3838
settings for control value 's' - see below.
3939
@@ -52,11 +52,11 @@ class Cwg128_64( BaseCWG ):
5252
PRNG. 's' must be initally odd. 'a', 'weyl' and initial state 'x' may be
5353
initialized each with any 64-bits value.
5454
55-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period CW-Generator
55+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5656
with very low computation time, medium period, 64 bits output values and
5757
very good randomness characteristics.
5858
59-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period CW-generator
59+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period CW-generator
6060
with very low computation time, medium period, 128 bits output values and
6161
very good randomness characteristics.
6262
@@ -72,9 +72,9 @@ class Cwg128_64( BaseCWG ):
7272
7373
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7474
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
75-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
76-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
77-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
75+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
76+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
77+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
7878
7979
* _small crush_ is a small set of simple tests that quickly tests some of
8080
the expected characteristics for a pretty good PRNG;
@@ -120,7 +120,7 @@ def next(self) -> int:
120120
self._weyl = (self._weyl + self._s) & 0xffff_ffff_ffff_ffff
121121
self._state = (((self._state | 1) * (self._a >> 1)) ^ self._weyl) & 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff
122122
# returns the xored-shifted output value
123-
return (self._state ^ (self._a >> 48)) & 0xffff_ffff_ffff_ffff
123+
return self._state ^ (self._a >> 48)
124124

125125

126126
#-------------------------------------------------------------------------

Python3.10/PyRandLib/cwg64.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Cwg64( BaseCWG ):
3333
"""
3434
Pseudo-random numbers generator - Collatz-Weyl pseudorandom Generator
3535
dedicated to 64-bits calculations and 64-bits output values with small
36-
period (min 2^70, i.e. 1.18e+21) but short computation time. All CWG
36+
period (min 2^64, i.e. 1.84e+19) but short computation time. All CWG
3737
algorithms offer multi streams features, by simply using different initial
3838
settings for control value 's' - see below.
3939
@@ -52,11 +52,11 @@ class Cwg64( BaseCWG ):
5252
PRNG. 's' must be initally odd. 'a', 'weyl' and initial state 'x' may be
5353
initialized each with any 64-bits value.
5454
55-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period CW-Generator
55+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5656
with very low computation time, medium period, 64-bits output values and
5757
very good randomness characteristics.
5858
59-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period CW-generator
59+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period CW-generator
6060
with very low computation time, medium period, 64- bits output values and
6161
very good randomness characteristics.
6262
@@ -72,9 +72,9 @@ class Cwg64( BaseCWG ):
7272
7373
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7474
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
75-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
76-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
77-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
75+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
76+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
77+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
7878
7979
* _small crush_ is a small set of simple tests that quickly tests some of
8080
the expected characteristics for a pretty good PRNG;

Python3.10/unit_tests/test_cwg128_64.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ def test_next(self):
148148
assert cwg._s == 0x157a3807a48faa9d
149149
assert cwg._state == 0xd573529b34a1d0932f90b72e996dccbe
150150

151-
for v in [0x74c316a37df311ec, 0xef317b6dbb8bb2c0, 0x1ede53528e8f1440, 0xadc9d06765afa5ba, 0x6afa7b40ecc40951]:
151+
for v in [
152+
0x5cd4_1015_afdd_c2d2_74c3_16a3_7df3_11ec,
153+
0x02db_2872_975a_0dc2_ef31_7b6d_bb8b_b2c0,
154+
0xe9ae_0772_75c3_945f_1ede_5352_8e8f_1440,
155+
0xfb7e_4d17_2841_1ef0_adc9_d067_65af_a5ba,
156+
0x0293_03b5_b41b_2417_d6af_a7b4_0ecc_40951
157+
]:
152158
assert cwg.next() == v
153159

154160
assert cwg._a == 0x602d6cf9c72ac16b

Python3.11/PyRandLib/basecwg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ class BaseCWG( BaseRandom ):
4747
implemented version. See implementation classes to get their formal
4848
description.
4949
50-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period CW-Generator
50+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5151
with low computation time, medium period, 64- bits output values and very
5252
good randomness characteristics.
5353
54-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period CW-Generator
54+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
5555
with very low computation time, medium period, 64-bits output values and
5656
very good randomness characteristics.
5757
58-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period CW-generator
58+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period CW-generator
5959
with very low computation time, medium period, 64- bits output values and
6060
very good randomness characteristics.
6161
@@ -71,9 +71,9 @@ class BaseCWG( BaseRandom ):
7171
7272
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7373
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
74-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
75-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
76-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
74+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
75+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
76+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
7777
7878
* _small crush_ is a small set of simple tests that quickly tests some of
7979
the expected characteristics for a pretty good PRNG;

Python3.11/PyRandLib/baserandom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class BaseRandom( Random ):
3434
3535
Copyright (c) 2016-2025 Philippe Schmouker
3636
37-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period Collatz-Weyl Generator
37+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period Collatz-Weyl Generator
3838
with low computation time, medium period, 64- bits output values and very good
3939
randomness characteristics.
40-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period C-W Generator with
40+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period C-W Generator with
4141
with very low computation time, medium period, 64-bits output values and very
4242
good randomness characteristics.
43-
See Cwg128 for a minimum 2^135 (i.e. about 4.36e+40) period C-W generator with
43+
See Cwg128 for a minimum 2^128 (i.e. about 6.81e+38) period C-W generator with
4444
very low computation time, medium period, 64- bits output values and very good
4545
randomness characteristics.
4646

Python3.11/PyRandLib/cwg128.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Cwg128( BaseCWG ):
3333
"""
3434
Pseudo-random numbers generator - Collatz-Weyl pseudo-random Generators
3535
dedicated to 128-bits calculations and 128-bits output values with large
36-
period (min 2^135, i.e. 4.36e+40) but short computation time. All CWG
36+
period (min 2^128, i.e. 6.81e+38) but short computation time. All CWG
3737
algorithms offer multi streams features, by simply using different initial
3838
settings for control value 's' - see below.
3939
@@ -56,11 +56,11 @@ class Cwg128( BaseCWG ):
5656
It appears that these value are used just are 's' for c[0], 'x' for c[1],
5757
'a' for c[2] and 'weyl' for c[3] in the other versions of the algorithm.
5858
59-
See Cwg64 for a minimum 2^70 (i.e. about 1.18e+21) period CW-Generator
59+
See Cwg64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
6060
with very low computation time, medium period, 64- bits output values and
6161
very good randomness characteristics.
6262
63-
See Cwg128_64 for a minimum 2^71 (i.e. about 2.36e+21) period CW-Generator
63+
See Cwg128_64 for a minimum 2^64 (i.e. about 1.84e+19) period CW-Generator
6464
with very low computation time, medium period, 64-bits output values and
6565
very good randomness characteristics.
6666
@@ -76,9 +76,9 @@ class Cwg128( BaseCWG ):
7676
7777
| PyRandLib class | [8] generator name | Memory Usage | Period | time-32bits | time-64 bits | SmallCrush fails | Crush fails | BigCrush fails |
7878
| --------------- | ------------------ | ------------- | -------- | ----------- | ------------ | ---------------- | ----------- | -------------- |
79-
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^70 | n.a. | n.a. | 0 | 0 | 0 |
80-
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^71 | n.a. | n.a. | 0 | 0 | 0 |
81-
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^135 | n.a. | n.a. | 0 | 0 | 0 |
79+
| Cwg64 | CWG64 | 8 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
80+
| Cwg128_64 | CWG128_64 | 10 x 4-bytes | >= 2^64 | n.a. | n.a. | 0 | 0 | 0 |
81+
| Cwg128 | CWG128 | 16 x 4-bytes | >= 2^128 | n.a. | n.a. | 0 | 0 | 0 |
8282
8383
* _small crush_ is a small set of simple tests that quickly tests some of
8484
the expected characteristics for a pretty good PRNG;

0 commit comments

Comments
 (0)