-
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
Fix random.random()
#2464
Fix random.random()
#2464
Conversation
Related PR lfortran/lfortran#3156 A Test is added in the related PR. Also manual test: % cat examples/expr2.py
from lpython import f64
import random
def test_seed():
random.seed()
t1: f64 = random.random()
print(t1)
test_seed()
% lpython examples/expr2.py
1.80525214961043207e-01
% lpython examples/expr2.py
8.56492263663789360e-02
% lpython examples/expr2.py
6.91035861936880158e-01
% lpython examples/expr2.py
6.65666734644056679e-01
% lpython examples/expr2.py
6.16492530618092283e-01
% lpython examples/expr2.py
2.97986548067064261e-01
% lpython examples/expr2.py
4.91210944713657227e-01
% lpython examples/expr2.py
8.56492263663789360e-02
% lpython examples/expr2.py
3.64365308249539388e-01
% lpython examples/expr2.py
3.07370851425161074e-01
% lpython examples/expr2.py
3.32739978717984608e-01
% lpython examples/expr2.py
4.64277766861150853e-01
% lpython examples/expr2.py
5.95815555004317154e-01
% lpython examples/expr2.py
4.84954742474926037e-01
% lpython examples/expr2.py
3.07370851425161074e-01
% lpython examples/expr2.py
1.26658859256030459e-01
% lpython examples/expr2.py
6.79743189681201843e-01
% lpython examples/expr2.py
4.67405867980516476e-01
% lpython examples/expr2.py
7.43338167082210122e-01
% lpython examples/expr2.py
8.85824309143155908e-01
% lpython examples/expr2.py
4.20140032852133749e-01
% lpython examples/expr2.py
3.44032650973663034e-01
% lpython examples/expr2.py
9.11193436435979498e-01
% lpython examples/expr2.py
1.77397113841677612e-01
% lpython examples/expr2.py
2.67925269095192320e-01
% lpython examples/expr2.py
6.11800378939043932e-01
% lpython examples/expr2.py
9.28742310930389170e-01
% lpython examples/expr2.py
5.38821098179938729e-01
% lpython examples/expr2.py
6.38733556791550305e-01
% lpython examples/expr2.py
9.69751943820040596e-01
% lpython examples/expr2.py
1.89261478460049960e-02
% lpython examples/expr2.py
7.01984215854659754e-01
|
The CI |
This is due to #2455. |
02a3b61
to
18b6ef4
Compare
This ensures srand() gets different (far-away) values for two subsequent executions of the compiler.
18b6ef4
to
1af763b
Compare
assert t1 != t2 | ||
assert t1 == t3 | ||
assert t1 != t4 | ||
assert t1 != t5 | ||
assert t4 == t5 | ||
assert t6 != t7 | ||
# 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.
@certik I commented this out as we discussed in the meet.
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.
That should be good.
The |
Yes, the CI issue is real, something goes wrong. |
fixes #2382