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

sage.misc.prandom misses several functions added in Python 3 #32439

Open
mkoeppe opened this issue Aug 31, 2021 · 6 comments · May be fixed by #34973
Open

sage.misc.prandom misses several functions added in Python 3 #32439

mkoeppe opened this issue Aug 31, 2021 · 6 comments · May be fixed by #34973

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 31, 2021

According to https://docs.python.org/3/library/random.html, we are missing the following random generators

As well as the classes to get generators without shared states

And the getter/setter

CC: @videlec

Component: misc

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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Aug 31, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@videlec
Copy link
Contributor

videlec commented Mar 5, 2022

comment:3
sage: import random
sage: import sage.misc.prandom
sage: sorted(name for name in set(dir(random)).difference(dir(sage.misc.prandom)) if not name.startswith('_') and callable(getattr(random, name)))
['Random',
 'SystemRandom',
 'choices',
 'getstate',
 'randbytes',
 'seed',
 'setstate',
 'triangular']

@videlec

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 2, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.8, sage-9.9 Jan 7, 2023
@Sandstorm831
Copy link
Contributor

Commit: 1a42056

@Sandstorm831
Copy link
Contributor

Branch: u/gh-Sandstorm831/32439

@Sandstorm831
Copy link
Contributor

New commits:

f0f4fc6minor documentation addition
7175d2fRevert "minor documentation addition"
81c4314implemented choices, randbytes and triangular functions
1a42056adding examples

I have added the functions along the examples, I wanted to know that do we have to write the complete Random class and SystemRandom class? Also getter, setter and seed have to be added in the both classes or seperately ?

@Sandstorm831 Sandstorm831 modified the milestones: sage-9.9, sage-9.8 Jan 9, 2023
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 12, 2023

Removed branch from the issue description because it has been replaced by PR #34973

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants