-
Notifications
You must be signed in to change notification settings - Fork 163
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
Implement random.seed() #2318
Implement random.seed() #2318
Conversation
@certik Can I use OS supplied PRNGs? I was thinking of writing the generator on my own, but it wouldn't be as cryptographically secure as |
What issue is this trying to fix? I would use the libc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks! I left some comments.
Thanks. I think this approach might work, I'll play with this soon. |
We have to be 100% compatible with CPython. In CPython,
But two different number in LPython (since 0 is used for clock initialization). |
@OmarMesqq I fixed it up, let's see if this works. |
@certik Nice! Sorry, I didn't create more thorough tests. Already paying attention to the new |
Thank you! |
assert t1 != t2 | ||
assert t1 == t3 | ||
assert t1 != t4 | ||
assert t1 != t5 | ||
assert t4 == t5 | ||
assert t6 != t7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are comparing floating point values here. I think we need to use range comparison abs(a - b) < 1e-5
here.
Fixes #2110.