8000 ENH: randomgen by mattip · Pull Request #13163 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: randomgen #13163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 139 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
3102fc6
INIT: Initial commit with basic structure
bashtage Feb 20, 2018
fa3bef5
ENH: Add support for xoroshiro128
bashtage Feb 22, 2018
d59494c
ENH: Add entropy initialization to RNGS
bashtage Feb 23, 2018
8942968
ENH: Add seeding to generators
bashtage Feb 23, 2018
aa9060c
CLN: Simplify xoroshiro state
bashtage Feb 24, 2018
b353f87
REF: Add additional state
bashtage Feb 26, 2018
15cab3c
REF: Reactor filler to take a function
bashtage Feb 28, 2018
8367231
ENH: Add extra abstraction
bashtage Feb 28, 2018
d5dc576
ENH: Add float from double and std exponential
bashtage Feb 28, 2018
f4575d9
BUG: Fix bug in xoroshiro
bashtage Mar 1, 2018
c687b84
CLN: Fix warning in entropy
bashtage Mar 1, 2018
0d4eae3
REF: Add types to prng_t
bashtage Mar 1, 2018
27a96bb
ENH: Add Threefry generator
bashtage Mar 2, 2018
a5f17a5
ENH: Use Random123 threefry
bashtage Mar 2, 2018
56fd6e7
CLN: Remove unnecessary code from threefry
bashtage Mar 2, 2018
93b7edf
ENH: Add pickle support
bashtage Mar 3, 2018
d665138
DOC: Add list of TODOs
bashtage Mar 3, 2018
892d43f
BIG: Fix setting state in threee fry
bashtage Mar 3, 2018
ad79fe0
ENH: Add jump and advance to threefry
bashtage Mar 3, 2018
4b2afc2
ENH: Add PCG64
bashtage Mar 4, 2018
6b81fa0
ENH: Add advance and jump to PCG64
bashtage Mar 4, 2018
e150e1a
ENH: Add Philox
bashtage Mar 5, 2018
d6d3ac9
CLN: Remove splitmix64 as a visible PRNG
bashtage Mar 5, 2018
323616c
BUG: Fix bugs which prevented building on Linux
bashtage Mar 5, 2018
626a1a0
REF: Refactor distributions
bashtage Mar 5, 2018
5fe7572
ENH: Add std gamma
bashtage Mar 5, 2018
cecd56d
CLN: Clean random123 generators
bashtage Mar 6, 2018
a071378
CLN: Fix dsfmt import issues
bashtage Mar 7, 2018
eab3390
ENH: Enable Python 2.7 compatability
bashtage Mar 7, 2018
c3155db
ENH: Add jump to mt19937 and dsfmt
bashtage Mar 7, 2018
e9e0a8c
ENH: Add ctypes interface and examples
bashtage Mar 7, 2018
0e5ffae
CLN: Mix skipped nogils
bashtage Mar 7, 2018
5d274af
ENH: Add cffi interface
bashtage Mar 7, 2018
2f9b9c0
ENH: Add example using distributions
bashtage Mar 8, 2018
fcef7ae
ENH: Enable building distributions as a DLL
bashtage Mar 8, 2018
1235545
ENH: Port over external functions
bashtage Mar 8, 2018
7ca6e62
ENH: Add bounded intergers
bashtage Mar 9, 2018
cfe9e95
ENH: Add support for Philon on 32 bit Windows
bashtage Mar 11, 2018
390860a
ENH: Add support for ThreeFry32x4
bashtage Mar 12, 2018
8fa8c2b
BUG: Enable build to run on 32-bit Linux
bashtage Mar 12, 2018
644d883
ENH: Add PCG32
bashtage Mar 12, 2018
e81e93f
BUG: Fix variable declarations in dsfmt
bashtage Mar 12, 2018
76a31a9
ENH: Enable testing on OSX
bashtage Mar 12, 2018
c1f4fa0
REF: Drop Box-Muller
bashtage Mar 13, 2018
ee51dcf
REF: Remove binomial_t from prng
bashtage Mar 13, 2018
fde7742
ENH: Switch to int64
bashtage Mar 13, 2018
fb98ac5
DOC: Start documentation
bashtage Mar 14, 2018
cb24575
REF: Rename from Core PRNG to RandomGen
bashtage Mar 14, 2018
c722f44
DOC: Update docs
bashtage Mar 14, 2018
e69d24c
TST: Improve travis
bashtage Mar 14, 2018
a85ee48
BUG: Fix failing test
bashtage Mar 14, 2018
701326e
DOC: Fix location of tagged docs
bashtage Mar 14, 2018
9e18b77
BLD: Ensure emulated math is used in 32 bit platforms
bashtage Mar 16, 2018
3e69d17
CLN: Remove references to long
bashtage Mar 22, 2018
489015f
ENH: Add Box-Muller gauss
bashtage Mar 21, 2018
8711b32
DOC: Update multithreading doc
bashtage Mar 27, 2018
018faf7
CLN: Remove set/get state for system generator
bashtage Mar 27, 2018
75025d9
TST: Fix tailing test on 32bit platofrms
bashtage Mar 27, 2018
4f37499
CLN: Fix str for RandomGenerator
bashtage Mar 28, 2018
7d37f5f
DOC: Update legacy docs
bashtage Mar 28, 2018
a2e21e6
BUG: Fix pickle for LegacyGenerator
bashtage Mar 28, 2018
d13f398
DOC: Spelling changes
bashtage Apr 2, 2018
df1758d
CLN: Remove redeclared type
bashtage Apr 2, 2018
412e908
BLD: Enable no-sse2 flag
bashtage Apr 3, 2018
87b52f2
SYNC/CLN: Sync with upstream changes
bashtage Apr 16, 2018
db87d7d
BLD: Add lm flag for non-windows platforms
bashtage May 2, 2018
b41949e
ENH: Add dSFMT
bashtage Mar 5, 2018
a9cb58d
ENH: Add out, ziggurat for exponential
bashtage Mar 5, 2018
92a09f3
TST: Add test and benchmark code
bashtage Mar 6, 2018
f029ebb
ENH: Improve benchmark
bashtage Mar 6, 2018
8777c61
CLN: Reformat C files
bashtage Mar 7, 2018
784315e
ENH: Example numba example using external distributions
bashtage Mar 8, 2018
5b262ef
BUG: Precent GC of CorePRNG when using CFFI/CTypes
bashtage Mar 8, 2018
65ceada
TST: Add tests
bashtage Mar 9, 2018
3b7b1e4
DOC: Update readme
bashtage Mar 11, 2018
a8882b2
CLN: Remove small bugs and alter variable size
bashtage Mar 12, 2018
dc0c84b
BUG: Fix returned type
bashtage Mar 13, 2018
f060614
DOC: Update docs and building
bashtage Mar 14, 2018
5d3d955
ENH: Restore filler
bashtage Mar 15, 2018
ce30b74
TST: Improve testing and build
bashtage Mar 17, 2018
447e6b3
DOC: Update change-log and docs
bashtage Mar 17, 2018
50e7242
BUG: Restore nogil for fillers
bashtage Mar 21, 2018
799e20b
TST: Make test more verbose, clean up noise
bashtage Mar 28, 2018
80a3fe1
BUG: Fix absolute_import
bashtage Apr 2, 2018
d780f06
DOC: Fix doc and example error
pdebuyl May 22, 2018
fdd029f
REF: Rename min and max macros
bashtage Jun 14, 2018
3dba22d
MAINT: Sync with NumPy changes
bashtage Jun 19, 2018
f2ace10
ENH: Allow empty choice
bashtage Jul 3, 2018
d0cb154
DOC: Provide a better explanation of bounded int generation
bashtage Sep 22, 2018
8e6b69f
MAINT: Sync with recent upstream changes
bashtage Sep 22, 2018
99bf1a0
DOC: Update docs for 1.15 release [skip ci]
bashtage Sep 22, 2018
8dba0e9
ENH: Added an alternative interval generator using Lemire's algorithm.
bduvenhage Oct 3, 2018
13d8999
DOC: Add license files
bashtage Oct 5, 2018
707371d
REF: Add path using umul
bashtage Oct 5, 2018
15bebed
ENH: Added Lemire algorithms for generating random numbers
bduvenhage Oct 11, 2018
734fbfb
CLN: Add guards to headers
bashtage Oct 21, 2018
c4ed60e
ENH/BUG: Add Xoshiro256starstar generator
bashtage Oct 20, 2018
9dac6a5
MAINT: Sync with upstream changes
bashtage Nov 5, 2018
578889b
BUG: Ensure buffer_loc is reset in DSFMT
bashtage Feb 4, 2019
896f2e4
BUG: Raise on nan probabilities
bashtage Feb 4, 2019
fa8af41
BUILD: move files out of _randomgen
mattip Mar 20, 2019
7e8e19f
BUG: Correct handling of nans
bashtage Apr 8, 2019
c53b2eb
BENCH: convert bencmarks to asv format
mattip Apr 9, 2019
9578dcf
BUG: __dealloc__ can be called without __init__ in some error modes
mattip Apr 12, 2019
0f3dd06
ENH: Extend multinomial and fix zipf
bashtage Apr 11, 2019
8a3c11d
DOC: Add alias docstrings for sample and ranf
bashtage Apr 12, 2019
bb7abf2
ENH: add instance of RandomGenerator(Xoshiro512StarStar) as gen
mattip Apr 12, 2019
f11921d
MAINT: Simplify return types
bashtage Apr 12, 2019
0f931b3
BUG: Fix type in zipf
bashtage Apr 13, 2019
b2f9bea
ENH: Improvce choice without replacement
bashtage Apr 13, 2019
7a41794
DOC: fix doctests, move numpy.random -> numpy.random.gen in generator…
mattip Apr 13, 2019
edfd313
ENH: Finish hypergeometric 0
bashtage Apr 13, 2019
b9b9d70
MAINT: remove legacy, refactor legacy -> mtrand in docs
mattip Apr 14, 2019
2deddc8
MAINT: Remove Cython conditionals
bashtage Apr 14, 2019
d531f92
BUG: Protect gamma generation from 0 input
bashtage Feb 18, 2019
6e386c0
DOC/ENH: Update docstring and enhance logistic
bashtage Feb 19, 2019
8621229
DOC: tighten up documentation, add a table of comparison
mattip Apr 14, 2019
4f06779
ENH: Add fast path for randint broadcasting
bashtage Apr 15, 2019
ca9c542
BUG: Cast high to Python int to avoid overflow
bashtage Apr 15, 2019
dd77ce3
ENH: Add closed generator to randint
bashtage Apr 16, 2019
17e0070
MAINT: Implement API changes for randomgen-derived code
mattip May 13, 2019
b42a5ca
BUG: Ensure integer-type stream on 32bit
bashtage May 18, 2019
720a0a9
BLD: Use numpy detection of SSE
bashtage May 19, 2019
e058ae4
MAINT: remove unused file
mattip May 20, 2019
3d19ae9
MAINT: remove threefry32, xoroshiro128, xorshift1024 BitGenerators
mattip May 20, 2019
060c669
merge master into branch
mattip May 22, 2019
4e6a812
MAINT: remove pre-randomgen _mtrand
mattip May 23, 2019
19b48e2
BUG: test, fix missing return to deprecated function
mattip May 23, 2019
cdb2b0f
MAINT: remove tomaxint, random_sample from generator
mattip May 23, 2019
2c14e47
ENH: Split poisson_lam_max
bashtage May 23, 2019
457c6c5
MAINT: Remove test_against_numpy
bashtage May 23, 2019
9e5ae61
BUG: Change renamed attribute
bashtage May 23, 2019
7c52c28
DOC: Add __all__ and document lock
bashtage May 23, 2019
dabf42b
MAINT: Remove remnants of bit generators
bashtage May 23, 2019
3db5a77
BLD: Improve setup
bashtage May 23, 2019
58c0e72
Revert "MAINT: Implement API changes for randomgen-derived code"
bashtage May 24, 2019
23853d6
STY: Clean up code
bashtage May 24, 2019
9c261e6
PERF: Reorder header for philox (#34)
bashtage May 27, 2019
70d6293
MAINT: fix for dtype specification
mattip May 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC/ENH: Update docstring and enhance logistic
Update docstring in _legacy.pyx for match generator.pyx
Fix docstring in the constaint checker which had ineq rather than eq.
Enhance logistic to accept 0 scale
Reorder functions in _legacy to match generator to simplify keeping doc strings
synchronized.
Synchronize the docstring in _legacy
  • Loading branch information
bashtage authored and mattip committed May 20, 2019
commit 6e386c05c292da49224fcab372013a6d4247ae3b
26 changes: 26 additions & 0 deletions _randomgen/README-git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
These are the bash commands used to get the bashtage/randomgen repo into numpy/numpy

```bash
# from a directory just above a numpy git checkout
git clone https://github.com/bashtage/randomgen.git
cd randomgen
# rewrite the checkout, pushing the content into '_randomgen'
git filter-branch --index-filter '
git ls-files -s |
sed "s-\t-\t_randomgen/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE
' HEAD
# write this file, commit it
git add _randomgen/README-git.md
git commit -m"Add README-git.md"
git checkout -b randomgen
cd ../numpy
git checkout -b randomgen
git remote add randomgen ../randomgen
git fetch randomgen randomgen
git merge --allow-unrelated-histories randomgen/randomgen
git remote remove randomgen
# Now all the randomgen commits are on the randomgen branch in numpy,
# and there is a subdirectory _randomgen with the content
```
6 changes: 3 additions & 3 deletions _randomgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ generators in Python and NumPy.

## Python 2.7 Support

Release 1.16.0 is the final version that supports Python 2.7. Any bugs
in v1.16.0 will be patched until the end of 2019. All future releases
v1.16 is the final major version that supports Python 2.7. Any bugs
in v1.16 will be patched until the end of 2019. All future releases
are Python 3, with an initial minimum version of 3.5.

## Compatibility Warning
Expand Down Expand Up @@ -164,7 +164,7 @@ need to be smoothed.
Building requires:

* Python (2.7, 3.5, 3.6, 3.7)
* NumPy (1.13, 1.14, 1.15)
* NumPy (1.13, 1.14, 1.15, 1.16)
* Cython (0.26+)
* tempita (0.5+), if not provided by Cython

Expand Down
8 changes: 4 additions & 4 deletions _randomgen/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ generators in Python and NumPy.
Python 2.7 Support
------------------

Release 1.16.0 is the final version that supports Python 2.7. Any bugs
in v1.16.0 will be patched until the end of 2019. All future releases
are Python 3, with an initial minimum version of 3.5.
v1.16 is the final major version that supports Python 2.7. Any bugs in
v1.16 will be patched until the end of 2019. All future releases are
Python 3, with an initial minimum version of 3.5.

Compatibility Warning
---------------------
Expand Down Expand Up @@ -181,7 +181,7 @@ Requirements
Building requires:

- Python (2.7, 3.5, 3.6, 3.7)
- NumPy (1.13, 1.14, 1.15)
- NumPy (1.13, 1.14, 1.15, 1.16)
- Cython (0.26+)
- tempita (0.5+), if not provided by Cython

Expand Down
5 changes: 5 additions & 0 deletions _randomgen/doc/source/change-log.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Change Log
----------
v1.16.1
=======
- Synchronized with upstream changes.
- Fixed a bug in gamma generation if the shape parameters is 0.0.

v1.16.0
=======
- Fixed a bug that affected :class:`~randomgen.dsfmt.DSFMT` when calling
Expand Down
2 changes: 1 addition & 1 deletion _randomgen/randomgen/common.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ cdef int check_constraint(double val, object name, constraint_type cons) except
raise ValueError(name + " <= 0")
elif cons == CONS_BOUNDED_0_1 or cons == CONS_BOUNDED_0_1_NOTNAN:
if val < 0 or val > 1:
raise ValueError(name + " <= 0 or " + name + " >= 1")
raise ValueError(name + " < 0 or " + name + " > 1")
if cons == CONS_BOUNDED_0_1_NOTNAN:
if np.isnan(val):
raise ValueError(name + ' contains NaNs')
Expand Down
124 changes: 85 additions & 39 deletions _randomgen/randomgen/generator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ cdef class RandomGenerator:
Parameters
----------
scale : float or array_like of floats
The scale parameter, :math:`\\beta = 1/\\lambda`.
The scale parameter, :math:`\\beta = 1/\\lambda`. Must be
non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -855,6 +856,8 @@ cdef class RandomGenerator:
if size > pop_size:
raise ValueError("Cannot take a larger sample than "
"population when 'replace=False'")
elif size < 0:
raise ValueError("negative dimensions are not allowed")

if p is not None:
if np.count_nonzero(p > 0) < size:
Expand Down Expand Up @@ -1017,6 +1020,12 @@ cdef class RandomGenerator:

Random values in a given shape.

.. note::
This is a convenience function for users porting code from Matlab,
and wraps `numpy.random.random_sample`. That function takes a
tuple to specify the size of the output, which is consistent with
other NumPy functions like `numpy.zeros` and `numpy.ones`.

Create an array of the given shape and populate it with
random samples from a uniform distribution
over ``[0, 1)``.
Expand Down Expand Up @@ -1065,16 +1074,20 @@ cdef class RandomGenerator:

Return a sample (or samples) from the "standard normal" distribution.

If positive, int_like or int-convertible arguments are provided,
`randn` generates an array of shape ``(d0, d1, ..., dn)``, filled
.. note::
This is a convenience function for users porting code from Matlab,
and wraps `numpy.random.standard_normal`. That function takes a
tuple to specify the size of the output, which is consistent with
other NumPy functions like `numpy.zeros` and `numpy.ones`.

If positive int_like arguments are provided, `randn` generates an array
of shape ``(d0, d1, ..., dn)``, filled
with random floats sampled from a univariate "normal" (Gaussian)
distribution of mean 0 and variance 1 (if any of the :math:`d_i` are
floats, they are first converted to integers by truncation). A single
float randomly sampled from the distribution is returned if no
argument is provided.
distribution of mean 0 and variance 1. A single float randomly sampled
from the distribution is returned if no argument is provided.

This is a convenience function. If you want an interface that takes a
tuple as the first argument, use `standard_normal` instead.
tuple as the first argument, use `numpy.random.standard_normal` instead.

Parameters
----------
Expand All @@ -1096,6 +1109,7 @@ cdef class RandomGenerator:
See Also
--------
standard_normal : Similar, but takes a tuple as its argument.
normal : Also accepts mu and sigma arguments

Notes
-----
Expand All @@ -1106,13 +1120,13 @@ cdef class RandomGenerator:
Examples
--------
>>> randomgen.generator.randn()
2.1923875335537315 #random
2.1923875335537315 # random

Two-by-four array of samples from N(3, 6.25):

>>> 2.5 * randomgen.generator.randn(2, 4) + 3
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random
>>> 3 + 2.5 * np.random.randn(2, 4)
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random

"""
if len(args) == 0:
Expand Down Expand Up @@ -1237,20 +1251,43 @@ cdef class RandomGenerator:
Returns
-------
out : float or ndarray
Drawn samples.
A floating-point array of shape ``size`` of drawn samples, or a
single sample if ``size`` was not specified.

Notes
-----
For random samples from :math:`N(\\mu, \\sigma^2)`, use one of::

mu + sigma * np.random.standard_normal(size=...)
np.random.normal(mu, sigma, size=...)

See Also
--------
normal :
Equivalent function with additional ``loc`` and ``scale`` arguments
for setting the mean and standard deviation.

Examples
--------
>>> s = randomgen.generator.standard_normal(8000)
>>> np.random.standard_normal()
2.1923875335537315 #random

>>> s = np.random.standard_normal(8000)
>>> s
array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, #random
-0.38672696, -0.4685006 ]) #random
array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, # random
-0.38672696, -0.4685006 ]) # random
>>> s.shape
(8000,)
>>> s = randomgen.generator.standard_normal(size=(3, 4, 2))
>>> s = np.random.standard_normal(size=(3, 4, 2))
>>> s.shape
(3, 4, 2)

Two-by-four array of samples from :math:`N(3, 6.25)`:

>>> 3 + 2.5 * np.random.standard_normal(size=(2, 4))
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random

"""
key = np.dtype(dtype).name
if key == 'float64':
Expand Down Expand Up @@ -1283,7 +1320,8 @@ cdef class RandomGenerator:
loc : float or array_like of floats
Mean ("centre") of the distribution.
scale : float or array_like of floats
Standard deviation (spread or "width") of the distribution.
Standard deviation (spread or "width") of the distribution. Must be
non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -1334,11 +1372,11 @@ cdef class RandomGenerator:

Verify the mean and the variance:

>>> abs(mu - np.mean(s)) < 0.01
True
>>> abs(mu - np.mean(s))
0.0 # may vary

>>> abs(sigma - np.std(s, ddof=1)) < 0.01
True
>>> abs(sigma - np.std(s, ddof=1))
0.1 # may vary

Display the histogram of the samples, along with
the probability density function:
Expand All @@ -1350,6 +1388,12 @@ cdef class RandomGenerator:
... linewidth=2, color='r')
>>> plt.show()

Two-by-four array of samples from N(3, 6.25):

>>> np.random.normal(3, 2.5, size=(2, 4))
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random

"""
return cont(&random_normal_zig, self._brng, size, self.lock, 2,
loc, '', CONS_NONE,
Expand Down Expand Up @@ -1530,7 +1574,7 @@ cdef class RandomGenerator:
Parameters
----------
shape : float or array_like of floats
Parameter, should be > 0.
Parameter, must be non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -1622,9 +1666,9 @@ cdef class RandomGenerator:
Parameters
----------
shape : float or array_like of floats
The shape of the gamma distribution. Should be greater than zero.
The shape of the gamma distribution. Must be non-negative.
scale : float or array_like of floats, optional
The scale of the gamma distribution. Should be greater than zero.
The scale of the gamma distribution. Must be non-negative.
Default is equal to 1.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
Expand Down Expand Up @@ -1706,9 +1750,9 @@ cdef class RandomGenerator:
Parameters
----------
dfnum : int or array_like of ints
Degrees of freedom in numerator. Should be greater than zero.
Degrees of freedom in numerator. Must be non-negative.
dfden : int or array_like of ints
Degrees of freedom in denominator. Should be greater than zero.
Degrees of freedom in denominator. Must be non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2262,7 +2306,7 @@ cdef class RandomGenerator:
Parameters
----------
a : float or array_like of floats
Shape of the distribution. Should be greater than zero.
Shape of the distribution. All values must be positive.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2443,7 +2487,7 @@ cdef class RandomGenerator:
Parameters
----------
a : float or array_like of floats
Parameter of the distribution. Should be greater than zero.
Parameter of the distribution. Must be positive.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2513,12 +2557,12 @@ cdef class RandomGenerator:
>>> plt.figure()
>>> plt.hist(rvs, bins=50, density=True)
>>> plt.plot(xx,powpdf,'r-')
>>> plt.title('randomgen.power(5)')
>>> plt.title('randomgen.generator.power(5)')

>>> plt.figure()
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
>>> plt.plot(xx,powpdf,'r-')
>>> plt.title('inverse of 1 + randomgen.pareto(5)')
>>> plt.title('inverse of 1 + randomgen.generator.pareto(5)')

>>> plt.figure()
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
Expand Down Expand Up @@ -2548,7 +2592,8 @@ cdef class RandomGenerator:
loc : float or array_like of floats, optional
The position, :math:`\\mu`, of the distribution peak. Default is 0.
scale : float or array_like of floats, optional
:math:`\\lambda`, the exponential decay. Default is 1.
:math:`\\lambda`, the exponential decay. Default is 1. Must be
non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2630,7 +2675,8 @@ cdef class RandomGenerator:
loc : float or array_like of floats, optional
The location of the mode of the distribution. Default is 0.
scale : float or array_like of floats, optional
The scale parameter of the distribution. Default is 1.
The scale parameter of the distribution. Default is 1. Must be
non-negative.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2746,7 +2792,7 @@ cdef class RandomGenerator:
loc : float or array_like of floats, optional
Parameter of the distribution. Default is 0.
scale : float or array_like of floats, optional
Parameter of the distribution. Should be greater than zero.
Parameter of the distribution. Must be >= 0.
Default is 1.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
Expand Down Expand Up @@ -2809,7 +2855,7 @@ cdef class RandomGenerator:
"""
return cont(&random_logistic, self._brng, size, self.lock, 2,
loc, 'loc', CONS_NONE,
scale, 'scale', CONS_POSITIVE,
scale, 'scale', CONS_NON_NEGATIVE,
0.0, '', CONS_NONE, None)

def lognormal(self, mean=0.0, sigma=1.0, size=None):
Expand All @@ -2828,8 +2874,8 @@ cdef class RandomGenerator:
mean : float or array_like of floats, optional
Mean value of the underlying normal distribution. Default is 0.
sigma : float or array_like of floats, optional
Standard deviation of the underlying normal distribution. Should
be greater than zero. Default is 1.
Standard deviation of the underlying normal distribution. Must be
non-negative. Default is 1.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2934,7 +2980,7 @@ cdef class RandomGenerator:
Parameters
----------
scale : float or array_like of floats, optional
Scale, also equals the mode. Should be >= 0. Default is 1.
Scale, also equals the mode. Must be non-negative. Default is 1.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -3463,7 +3509,7 @@ cdef class RandomGenerator:
Parameters
----------
a : float or array_like of floats
Distribution parameter. Should be greater than 1.
Distribution parameter. Must be greater than 1.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down
Loading
0