Open mkoeppe opened 3 years ago
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']
Description changed:
---
+++
@@ -1,3 +1,17 @@
-https://docs.python.org/3/library/random.html
+According to https://docs.python.org/3/library/random.html, we are missing the following random generators
-For example, there is `random.triangular` but no `sage.misc.prandom.triangular`.
+- [choices](https://docs.python.org/3/library/random.html#random.choices) (added in Python 3.6)
+- [randbytes](https://docs.python.org/3/library/random.html#random.randbytes) (added in Python 3.9)
+- [triangular](https://docs.python.org/3/library/random.html#random.triangular)
+
+As well as the classes to get generators without shared states
+
+- [Random class](https://docs.python.org/3/library/random.html#random.Random)
+- [SystemRandom class](https://docs.python.org/3/library/random.html#random.Random)
+
+And the getter/stter
+
+- [seed](https://docs.python.org/3/library/random.html#random.seed)
+- [getstate](https://docs.python.org/3/library/random.html#random.getstate)
+- [setstate](https://docs.python.org/3/library/random.html#random.setstate)
+
Commit: 1a42056
Branch: u/gh-Sandstorm831/32439
New commits:
f0f4fc6 | minor documentation addition |
7175d2f | Revert "minor documentation addition" |
81c4314 | implemented choices, randbytes and triangular functions |
1a42056 | adding 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 ?
Removed branch from the issue description because it has been replaced by PR #34973
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