Skip to content
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

ZZ.random_element gives incorrect description of mpz_rrandomb distribution #32319

Open
paiv opened this issue Aug 1, 2021 · 0 comments
Open

Comments

@paiv
Copy link

paiv commented Aug 1, 2021

The reference for ZZ.random_element gives this description:

If the distribution 'mpz_rrandomb' is specified, the output is in the range from 0 to 2x-1.

This does not match the GMP description:

The random number will be in the range 2n-1 to 2n-1, inclusive.

And can be observed with

sage: histogram([ZZ.random_element(1, distribution='mpz_rrandomb') for _ in range(100)])

The reference manual should be updated to reflect actual behavior of mpz_rrandomb.

If we want the originally described range 0 to 2x-1, mpz_urandomb should be added as a supported distribution.

Depends on #12496

Component: documentation

Issue created by migration from https://trac.sagemath.org/ticket/32319

@paiv paiv added this to the sage-9.4 milestone Aug 1, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants