Implement random.seed()#2318
Implement random.seed()#2318certik merged 2 commits intolcompilers:mainfrom OmarMesqq:feat/improve-random-seed-entropy
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 |
certik
left a comment
There was a problem hiding this comment.
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.
We are comparing floating point values here. I think we need to use range comparison abs(a - b) < 1e-5 here.
Fixes #2110.