+ 2
Why this code behaves abnormally when using numpy?
So in this code I used the randint function from the built-in random module. But when I use the randint function from numpy's random module it shows some unexpected results. Why does this happen? You can try this by changing the first line with: from numpy.random import randint https://code.sololearn.com/croZDPmy580X/?ref=app
2 Answers
+ 3
random.randint(a, b) returns a number with the upper bound inclusive
(a <= x <= b)
numpy.random.randint(a, b) returns a number with upper bound exclusive
(a <= x < b)
It's not abnormal, they are just different.
+ 3
Tibor Santa Hm.. That's what I was thinking. Thanks for the confirmation. đ