Skip to content

Commit

Permalink
RLS: Small clean-up prior to 1.15.1 release
Browse files Browse the repository at this point in the history
Fix documentation
Add information about Lemire generator
Update change log
Fix docstring for randint
  • Loading branch information
bashtage committed Nov 10, 2018
1 parent 60b19e2 commit 392ca93
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ which can fully reproduce the sequence produced by NumPy.
* Normals (`standard_normal`)
* Standard Gammas (via `standard_gamma`)

* Support for Lemire's method of generating uniform integers on an
arbitrary interval by setting `use_masked=True`.

## Included Pseudo Random Number Generators

This module includes a number of alternative random
Expand Down Expand Up @@ -103,6 +106,10 @@ The RNGs include:
* Core random number generators can fill existing arrays using the
`out` keyword argument
* Standardizes integer-values random values as int64 for all platforms.
* `randint` supports generating using rejection sampling on masked
values (the default) or Lemire's method. Lemire's method can be much
faster when the required interval length is much smaller than the
closes power of 2.

### New Functions

Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Features
- Normals (``standard_normal``)
- Standard Gammas (via ``standard_gamma``)

- Support for Lemire’s method of generating uniform integers on an
arbitrary interval by setting ``use_masked=True``.

Included Pseudo Random Number Generators
----------------------------------------

Expand Down Expand Up @@ -111,6 +114,10 @@ New Features
- Core random number generators can fill existing arrays using the
``out`` keyword argument
- Standardizes integer-values random values as int64 for all platforms.
- ``randint`` supports generating using rejection sampling on masked
values (the default) or Lemire’s method. Lemire’s method can be much
faster when the required interval length is much smaller than the
closes power of 2.

New Functions
~~~~~~~~~~~~~
Expand Down
12 changes: 6 additions & 6 deletions doc/source/change-log.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Change Log
----------

After v1.15
===========
- Added Xoshiro256** and Xoshiro512**, the preferred generators of this class
- Fixed bug in `jump` method of Random123 generators which did nto specify a default value


v1.15.1
=======
- Added Xoshiro256** and Xoshiro512**, the preferred generators of this class.
- Fixed bug in `jump` method of Random123 generators which did nto specify a default value.
- Added support for generating bounded uniform integers using Lemire's method.
- Synchronized with upstream changes, which requires moving the minimum supported NumPy to 1.13.

v1.15
=====
Expand Down
5 changes: 5 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ What's New or Different
these basic RNGs to be used in numba.
* The basic random number generators can be used in downstream projects via
Cython.
* Support for Lemire’s method [Lemire]_ of generating uniform integers on an
arbitrary interval by setting ``use_masked=True`` in
(:meth:`~randomgen.generator.RandomGenerator.randint`).


See :ref:`new-or-different` for a complete list of improvements and
differences.
Expand Down Expand Up @@ -205,6 +209,7 @@ New Features
Comparing Performance <performance>
extending
Reading System Entropy <entropy>
references

Changes
~~~~~~~
Expand Down
9 changes: 9 additions & 0 deletions doc/source/new-or-different.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,12 @@ What's New or Different
print(existing)
.. * For changes since the previous release, see the :ref:`change-log`
* Support for Lemire’s method of generating uniform integers on an
arbitrary interval by setting ``use_masked=True`` in
(:meth:`~randomgen.generator.RandomGenerator.randint`).

.. ipython:: python
%timeit rg.randint(0, 1535, use_masked=False)
%timeit numpy.random.randint(0, 1535)
5 changes: 5 additions & 0 deletions doc/source/references.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
References
----------

.. [Lemire] Daniel Lemire., "Fast Random Integer Generation in an Interval",
CoRR, Aug. 13, 2018, http://arxiv.org/abs/1805.10941.
7 changes: 6 additions & 1 deletion randomgen/generator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ cdef class RandomGenerator:

def randint(self, low, high=None, size=None, dtype=int, use_masked=True):
"""
randint(low, high=None, size=None, dtype='l')
randint(low, high=None, size=None, dtype='l', use_masked=True)
Return random integers from `low` (inclusive) to `high` (exclusive).
Expand Down Expand Up @@ -652,6 +652,11 @@ cdef class RandomGenerator:
>>> randomgen.randint([1, 3, 5, 7], [[10], [20]], dtype=np.uint8)
array([[ 8, 6, 9, 7],
[ 1, 16, 9, 12]], dtype=uint8)
References
----------
.. [1] Daniel Lemire., "Fast Random Integer Generation in an Interval",
CoRR, Aug. 13, 2018, http://arxiv.org/abs/1805.10941.
"""
if high is None:
high = low
Expand Down

0 comments on commit 392ca93

Please sign in to comment.