Skip to content

Commit a49b1cf

Browse files
committed
#219-fix typos in docstrings
Completed. Fully validated.
1 parent d41190c commit a49b1cf

File tree

114 files changed

+350
-293
lines changed

Some content is hidden

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

114 files changed

+350
-293
lines changed

Python3.10/PyRandLib/listindexstate.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ListIndexState( BaseRandom ):
3030
"""The base class for all LFib PRNG based on 64-bits numbers.
3131
3232
Definition of the class of the internal state data for many pseudo
33-
random generators: those that embed a list a integers and maybe an
34-
index related to this list..
33+
random generators: those that embed a list of integers and maybe an
34+
index related to this list.
3535
3636
This module is part of library PyRandLib.
3737
@@ -47,14 +47,13 @@ def __init__(self, _initRandClass, _stateSize: int, _seedState: SeedStateType =
4747
initialization of the internal state list of integers.
4848
_stateSize is the size of the internal state list of integers.
4949
_seedState is either a valid state, an integer, a float or None.
50-
About valid state: this is a tuple containing a list of
50+
About valid state: this is a tuple containing a list of
5151
self._STATE_SIZE integers and an index in this list (index value
5252
being then in range (0,self._STATE_SIZE)). Should _seedState be
53-
a sole integer or float then it is used as initial seed for
53+
a sole integer or float then it is used as initial seed for
5454
the random filling of the internal list of self._STATE_SIZE
55-
integers. Should _seedState be anything else (e.g. None) then
56-
the shuffling of the local current time value is used as such an
57-
initial seed.
55+
integers. Should _seedState be None) then the shuffling of the
56+
local current time value is used as such an initial seed.
5857
"""
5958
self._initRandClass = _initRandClass
6059
self._STATE_SIZE = _stateSize
@@ -66,11 +65,11 @@ def __init__(self, _initRandClass, _stateSize: int, _seedState: SeedStateType =
6665

6766
#-------------------------------------------------------------------------
6867
def getstate(self) -> StateType:
69-
"""Returns an object capturing the current internal state of the generator.
68+
"""Returns a tuple capturing the current internal state of the generator.
7069
71-
This object can be passed to setstate() to restore the state. It is a
72-
tuple containing a list of self._STATE_SIZE integers and an
73-
index in this list (index value being then in range(0,self._STATE_SIZE).
70+
This object can be passed to setstate() to restore the state. It is a
71+
tuple containing a list of self._STATE_SIZE integers and an index in
72+
this list (index value being then in range(0,self._STATE_SIZE).
7473
"""
7574
return (self._state, self._index) # type: ignore
7675

@@ -152,9 +151,9 @@ def _initstate(self, _initialSeed: Numerical = None, /) -> None: # type: ignore
152151
"""Inits the internal list of values.
153152
154153
Inits the internal list of values according to some initial
155-
seed that has to be an integer or a float ranging within
156-
[0.0, 1.0). Should it be None or anything else then the
157-
current local time value is used as initial seed value.
154+
seed that has to be an integer, or a float ranging within
155+
[0.0, 1.0). Should it be None then the current local time
156+
value is used as the initial seed value.
158157
"""
159158
initRand = self._initRandClass( _initialSeed )
160159
self._state = [ initRand() for _ in range(self._STATE_SIZE) ]

Python3.10/PyRandLib/melg19937.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Melg19937( BaseMELG ):
4646
Notice: the implementation of this version of the MELG algorithm in PyRandLib is
4747
not as optimized as it is in C code provided by MELG authors. It is rather derived
4848
from the formal description and related tables provided in paper referenced [11]
49-
in file README.md, to be able to easier validate the Python code here.
49+
in file README.md, to be able to easier validate the Python code here.
5050
5151
Notice also: in the original paper [11], in the description of Algorithm 1, an
5252
error (typo) appears at the initialization of 'x'. An bit-xor operation appears
@@ -56,6 +56,7 @@ class Melg19937( BaseMELG ):
5656
See Melg607 for a large period MELG-Generator (2^607, i.e. 5.31e+182) with medium
5757
computation time and the equivalent of 21 32-bits integers memory little
5858
consumption.
59+
5960
See Melg44497 for a very large period (2^44,497, i.e. 8.55e+13,395) with similar
6061
computation time but use of even more memory space (equivalent of 1,393 32-bits
6162
integers). This is the longest period version proposed in paper [11].

Python3.10/PyRandLib/melg44497.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Melg44497( BaseMELG ):
4646
Notice: the implementation of this version of the MELG algorithm in PyRandLib is
4747
not as optimized as it is in C code provided by MELG authors. It is rather derived
4848
from the formal description and related tables provided in paper referenced [11]
49-
in file README.md, to be able to easier validate the Python code here.
49+
in file README.md, to be able to easier validate the Python code here.
5050
5151
Notice also: in the original paper [11], in the description of Algorithm 1, an
5252
error (typo) appears at the initialization of 'x'. An bit-xor operation appears
@@ -56,6 +56,7 @@ class Melg44497( BaseMELG ):
5656
See Melg607 for a large period MELG-Generator (2^607, i.e. 5.31e+182) with medium
5757
computation time and the equivalent of 21 32-bits integers memory little
5858
consumption.
59+
5960
See Melg19937 for an even larger period MELG-Generator (2^19937, i.e. 4.32e+6001),
6061
same computation time and equivalent of 625 integers memory consumption.
6162

Python3.10/PyRandLib/melg607.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Melg607( BaseMELG ):
4646
Notice: the implementation of this version of the MELG algorithm in PyRandLib is
4747
not as optimized as it is in C code provided by MELG authors. It is rather derived
4848
from the formal description and related tables provided in paper referenced [11]
49-
in file README.md, to be able to easier validate the Python code here.
49+
in file README.md, to be able to easier validate the Python code here.
5050
5151
Notice also: in the original paper [11], in the description of Algorithm 1, an
5252
error (typo) appears at the initialization of 'x'. An bit-xor operation appears
@@ -55,6 +55,7 @@ class Melg607( BaseMELG ):
5555
5656
See Melg19937 for an even larger period MELG-Generator (2^19937, i.e. 4.32e+6001),
5757
same computation time and equivalent of 625 integers memory consumption.
58+
5859
See Melg44497 for a very large period (2^44,497, i.e. 8.55e+13,395) with similar
5960
computation time but use of even more memory space (equivalent of 1,393 32-bits
6061
integers). This is the longest period version proposed in paper [11].

Python3.10/PyRandLib/mrg1457.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Mrg1457( BaseMRG ):
3535
Generator with long period (3.98e+438).
3636
3737
This module is part of library PyRandLib.
38+
39+
Copyright (c) 2016-2025 Philippe Schmouker
3840
3941
Multiple Recursive Generators (MRGs) uses recurrence to evaluate pseudo-random
4042
numbers suites. Recurrence is of the form:
@@ -60,6 +62,7 @@ class Mrg1457( BaseMRG ):
6062
6163
See Mrg287 for a short period MR-Generator (2^287, i.e. 2.49e+86) with low
6264
computation time but 256 integers memory consumption.
65+
6366
See Mrg49507 for a far longer period (2^49507, i.e. 1.2e+14903) with lower
6467
computation time too (31-bits modulus) but use of more memory space (1597
6568
integers).
@@ -69,6 +72,7 @@ class Mrg1457( BaseMRG ):
6972
random(), seed(), getstate(), and setstate().
7073
7174
Furthermore this class is callable:
75+
rand = Mrg1457()
7276
print( rand() ) # prints a pseudo-random value within [0.0, 1.0)
7377
print( rand(a) ) # prints a pseudo-random value within [0, a) or [0.0, a) depending on the type of a
7478
print( rand(a, n) ) # prints a list of n pseudo-random values each within [0, a)

Python3.10/PyRandLib/mrg287.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class Mrg287( BaseMRG ):
7777
See Mrg1457 for a longer period MR-Generator (2^1457, i.e. 4.0e+438) and longer
7878
computation time (2^31-1 modulus calculations) but less memory space consumption
7979
(47 integers).
80+
8081
See Mrg49507 for a far longer period (2^49507, i.e. 1.2e+14903) with lower
8182
computation time too (31-bits modulus) but use of more memory space (1_597
8283
integers).

Python3.10/PyRandLib/mrg49507.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Mrg49507( BaseMRG ):
3535
Generator with a very long period (1.17e+14_903).
3636
3737
This module is part of library PyRandLib.
38+
39+
Copyright (c) 2016-2025 Philippe Schmouker
3840
3941
Multiple Recursive Generators (MRGs) uses recurrence to evaluate pseudo-random
4042
numbers suites. Recurrence is of the form:
@@ -60,6 +62,7 @@ class Mrg49507( BaseMRG ):
6062
6163
See Mrg287 fo r a short period MR-Generator (2^287, i.e. 2.49e+86) with low
6264
computation time but 256 integers memory consumption.
65+
6366
See Mrg457 for a longer period MR-Generator (2^1457, i.e. 4.0e+438) and longer
6467
computation time (2^31-1 modulus calculations) but less memory space consumption
6568
(47 integers).

Python3.10/PyRandLib/pcg1024_32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Pcg1024_32( Pcg64_32 ):
4747
4848
x(i) = (a * x(i-1) + c) mod m
4949
50-
PCGs associate to this recurrence a permutation of a subpart o f the bits
50+
PCGs associate to this recurrence a permutation of a subpart of the bits
5151
of the internal state of the PRNG. The output of PCGs is this permutated
5252
subpart of its internal state, leading to a very large enhancement of the
5353
randomness of these algorithms compared with the LCGs one.

Python3.10/PyRandLib/pcg128_64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Pcg128_64( BasePCG ):
4545
4646
x(i) = (a * x(i-1) + c) mod m
4747
48-
PCGs associate to this recurrence a permutation of a subpart o f the bits
48+
PCGs associate to this recurrence a permutation of a subpart of the bits
4949
of the internal state of the PRNG. The output of PCGs is this permutated
5050
subpart of its internal state, leading to a very large enhancement of the
5151
randomness of these algorithms compared with the LCGs one.

Python3.10/PyRandLib/pcg64_32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Pcg64_32( BasePCG ):
4343
4444
x(i) = (a * x(i-1) + c) mod m
4545
46-
PCGs associate to this recurrence a permutation of a subpart o f the bits
46+
PCGs associate to this recurrence a permutation of a subpart of the bits
4747
of the internal state of the PRNG. The output of PCGs is this permutated
4848
subpart of its internal state, leading to a very large enhancement of the
4949
randomness of these algorithms compared with the LCGs one.

0 commit comments

Comments
 (0)