safe_dx_pcg64
Provides public interfaces for SAFE-DX-PCG64 and eSAFE-DX-PCG64 generators.
This module provides end-user interfaces for constructing NumPy-compatible BitGenerator objects that combine a 32-bit DX generator and PCG64 through mutual shuffling and output transformations.
SAFE_DX_PCG64() produces one output value per internal update.
eSAFE_DX_PCG64_M4() and eSAFE_DX_PCG64_M8() are multi-output extensions
that produce and buffer four and eight output values per internal update,
respectively.
For each generator, the DX parameter set, shuffle-table size, burn-in length, and the PCG64 state, increment, and multiplier are derived from the seed. The shuffle-table size is selected from 32, 64, 128, 256, and 512, while the burn-in length is selected from 1 through 5.
By default, randomize=True mixes fresh system entropy and the current time
with the optional user-provided seed. Consequently, repeated calls with the
same seed are not reproducible. Set randomize=False and provide a fixed
seed when reproducible generator configurations and output sequences are
required.
Examples:
>>> from nextrngbook.safe_dx_pcg64 import SAFE_DX_PCG64
>>> SAFE_DX_PCG64()
Done. SAFE-DX-PCG64 generator combining DX and PCG64. Use print() function for details.
>>> from nextrngbook.safe_dx_pcg64 import eSAFE_DX_PCG64_M4
>>> eSAFE_DX_PCG64_M4()
Done. eSAFE-DX-PCG64-M4 generator combining DX and PCG64. Use print() function for details.
>>> from nextrngbook.safe_dx_pcg64 import eSAFE_DX_PCG64_M8
>>> eSAFE_DX_PCG64_M8()
Done. eSAFE-DX-PCG64-M8 generator combining DX and PCG64. Use print() function for details.
Functions:
-
SAFE_DX_PCG64(seed=None, randomize=True)Creates a SAFE-DX-PCG64 generator with one output per internal update. -
eSAFE_DX_PCG64_M4(seed=None, randomize=True)Creates a eSAFE-DX-PCG64 generator with four buffered outputs per internal update. -
eSAFE_DX_PCG64_M8(seed=None, randomize=True)Creates a eSAFE-DX-PCG64 generator with eight buffered outputs per internal update.
Type Aliases:
SeedType- Type alias for valid seed input types. Can beNone,int,NDArray[np.integer],SeedSequence, or a sequence of integers.
SAFE_DX_PCG64(seed, randomize)
Creates a 32-bit SAFE-DX-PCG64 BitGenerator.
The generator combines a 32-bit DX generator and PCG64 through mutual shuffling and output transformations. One output value is produced during each internal update.
The DX parameter set, shuffle-table size, burn-in length, PCG64 multiplier, and PCG64 increment are selected internally from the seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
SeedType
|
Seed used for parameter selection and generator initialization.
If |
None
|
randomize
|
bool
|
If True, mix fresh system entropy and the current time with the optional seed. If False, use the supplied seed directly for reproducible initialization. |
True
|
Returns:
| Type | Description |
|---|---|
_SAFE_DX_PCG64_Generator
|
A |
Examples:
eSAFE_DX_PCG64_M4(seed, randomize)
Creates a 32-bit eSAFE-DX-PCG64-M4 BitGenerator.
The generator combines a 32-bit DX generator and PCG64 through mutual shuffling and output transformations. Four output values are produced and buffered during each internal update.
The DX parameter set, shuffle-table size, burn-in length, PCG64 multiplier, and PCG64 increment are selected internally from the seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
SeedType
|
Seed used for parameter selection and generator initialization.
If |
None
|
randomize
|
bool
|
If True, mix fresh system entropy and the current time with the optional seed. If False, use the supplied seed directly for reproducible initialization. |
True
|
Returns:
| Type | Description |
|---|---|
_eSAFE_DX_PCG64_M4_Generator
|
A |
Examples:
eSAFE_DX_PCG64_M8(seed, randomize)
Creates a 32-bit eSAFE-DX-PCG64-M8 BitGenerator.
The generator combines a 32-bit DX generator and PCG64 through mutual shuffling and output transformations. Eight output values are produced and buffered during each internal update.
The DX parameter set, shuffle-table size, burn-in length, PCG64 multiplier, and PCG64 increment are selected internally from the seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
SeedType
|
Seed used for parameter selection and generator initialization.
If |
None
|
randomize
|
bool
|
If True, mix fresh system entropy and the current time with the optional seed. If False, use the supplied seed directly for reproducible initialization. |
True
|
Returns:
| Type | Description |
|---|---|
_eSAFE_DX_PCG64_M8_Generator
|
A |
Examples: