Skip to content

Commit

Permalink
Merge pull request #348 from bashtage/rls-1.26-v2
Browse files Browse the repository at this point in the history
RLS: Final fixes for release 1.26
  • Loading branch information
bashtage authored Sep 21, 2023
2 parents ccbc5df + 65cd7b2 commit 30f2762
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions doc/source/bit_generators/efiix64.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HC-128 Cipher Generator
-----------------------
Entropy From Iteration, Indirection, Xor (EFIIX) Generator
-----------------------------------------------------------

.. module:: randomgen.efiix64

Expand Down
8 changes: 8 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,5 +268,13 @@ def show(*args, **kwargs):
napoleon_preprocess_types = True
napoleon_use_param = True

napoleon_type_aliases = {
"array-like": ":term:`array-like <array_like>`",
"array_like": ":term:`array_like`",
"ndarray": "numpy.ndarray",
"np.ndarray": "numpy.array",
}


autosummary_generate = True
autoclass_content = "class"
10 changes: 5 additions & 5 deletions doc/source/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ Performance
Recommendation
**************
The recommended generator for single use is :class:`~randomgen.pcg64.PCG64DXSM`
although :class:`~randomgen.sfc64.SFC64` and :class:`~randomgen.xoshiro256.Xoshiro256`
although :class:`~randomgen.sfc.SFC64` and :class:`~randomgen.xoshiro256.Xoshiro256`
are both excellent alternatives. :class:`~randomgen.romu.Romu` is a newer generator that
is also very fast.

For very large scale
applications -- requiring 1,000+ streams --
:class:`~randomgen.pcg64.PCG64DXSM` combined with a :class:`~numpy.random.SeedSequence` and ``spawn``,
:class:`~randomgen.sfc64.SFC64` initialized using distinct Weyl increments (``k``), or one of
:class:`~randomgen.sfc.SFC64` initialized using distinct Weyl increments (``k``), or one of
the cryptography-based generators :class:`~randomgen.aes.AESCounter` (if you have hardware acceleration),
:class:`~randomgen.effix64.EFFIC64`, :class:`~randomgen.speck128.SPECK128`,
:class:`~randomgen.efiix64.EFIIX64`, :class:`~randomgen.speck128.SPECK128`,
:class:`~randomgen.philox.Philox`, or :class:`~randomgen.hc128.HC128` if you do not)
initialized with distinct keys are all excellent choices.

Expand All @@ -27,10 +27,10 @@ Timings
*******

The timings below are the time in ns to produce 1 random value from a
specific distribution. :class:`~randomgen.sfc64.SFC64` is the fastest,
specific distribution. :class:`~randomgen.sfc.SFC64` is the fastest,
followed closely by :class:`~randomgen.xoshiro256.Xoshiro256`,
:class:`~randomgen.pcg64.PCG64DXSM`, :class:`~randomgen.jsf.JSF`,
and :class:`~randomgen.effix64.EFFIX64`. The original
and :class:`~randomgen.efiix64.EFIIX64`. The original
NumPy :class:`~randomgen.mt19937.MT19937` generator is slower since
it requires 2 32-bit values to equal the output of the faster generators.

Expand Down
6 changes: 4 additions & 2 deletions randomgen/_seed_sequence.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class ISeedSequence(metaclass=abc.ABCMeta):
Parameters
----------
n_words : int
Number of 32- or 64-bit words to generate.
dtype : np.uint32 or np.uint64, optional
The size of each word. This should only be either `uint32` or
`uint64`. Strings (`"uint32"`, `"uint64"`) are fine. Note that
Expand All @@ -200,12 +201,13 @@ class ISeedSequence(metaclass=abc.ABCMeta):
Returns
-------
state : uint32 or uint64 array, shape=(n_words,)
state : uint32 or uint64 array
Array with shape (n_words,)
"""


class ISpawnableSeedSequence(ISeedSequence):
"""
"""w
Abstract base class for seed sequences that can spawn.
"""

Expand Down
6 changes: 3 additions & 3 deletions randomgen/common.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ cdef class BitGenerator:
Returns
-------
interface : namedtuple
interface : NamedTuple
Named tuple containing ctypes wrapper
* state_address - Memory address of the state struct
Expand All @@ -185,7 +185,7 @@ cdef class BitGenerator:
Returns
-------
interface : namedtuple
interface : NamedTuple
Named tuple containing CFFI wrapper
* state_address - Memory address of the state struct
Expand Down Expand Up @@ -292,7 +292,7 @@ cdef object prepare_cffi(bitgen_t *bitgen):

Returns
-------
interface : namedtuple
interface : NamedTuple
The functions required to interface with the bit generator using cffi

* state_address - Memory address of the state struct
Expand Down
2 changes: 1 addition & 1 deletion randomgen/entropy.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def random_entropy(size=None, source="system"):
Returns
-------
entropy : scalar or array
entropy : scalar or ndarray
Entropy bits in 32-bit unsigned integers. A scalar is returned if size
is `None`.
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import Distribution, find_namespace_packages, find_packages, setup
from setuptools import Distribution, find_namespace_packages, setup
from setuptools.extension import Extension

import glob
Expand Down Expand Up @@ -346,9 +346,7 @@ def is_pure(self):
force=CYTHON_COVERAGE or DEBUG,
gdb_debug=DEBUG,
),
packages=sorted(
set(find_packages() + find_namespace_packages(include=["randomgen.*"]))
),
packages=["randomgen"] + find_namespace_packages(include=["randomgen.*"]),
package_dir={"randomgen": "./randomgen"},
package_data={
"": ["*.h", "*.pxi", "*.pyx", "*.pxd", "*.in", "py.typed"],
Expand Down

0 comments on commit 30f2762

Please sign in to comment.