8000 DOC: Add example for ``np.random.default_rng().beta()`` by linus-md · Pull Request #25349 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Add example for np.random.default_rng().beta() #25349

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

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
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
a=b case
  • Loading branch information
linus-md committed Dec 9, 2023
commit 347a5b6fe5276f50fafd62144ade9508a96e7e2c
9 changes: 8 additions & 1 deletion numpy/random/_generator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,14 @@ cdef class Generator:
>>> plt.xlim([0, .2])
>>> plt.show()

If ``a == b``
If ``a == b`` and both are > 1, the distribution is symmetric with
mean 1/2.

>>> a, b = 2.0, 2.0
>>> sample = rng.beta(a, b, size=size)
>>> np.mean(sample)
0.5047328775385895 # may vary

"""
return cont(&random_beta, &self._bitgen, size, self.lock, 2,
a, 'a', CONS_POSITIVE,
Expand Down
0