When trying to simulate throwing two dice I stumbled across this:
randint(1,6)+randint(1,6) gets simplified to 2*randint(1,6)
That does not yield the expected result of two individual dice being thrown, but instead of one dice being thrown and counted twice, which is a huge difference.
This also happens in other places, e.g. in Sequences where one might want to visualize a distribution of values when throwing a certain number of dice.
I propose that random integers should be treated as always different so they won't be combined when simplifying the term
This also extends to something like random()-random() which always gets simplified to 0
That's a good catch π
like random()-random() which always gets simplified to 0
Are you sure? Maybe you were just (un)lucky? π
βThe generation of random numbers is too important to be left to chance.β
--forgot who
Robert R. Coveyou: http://www.quotationspage.com/quote/461.html
like random()-random() which always gets simplified to 0
Are you sure? Maybe you were just (un)lucky? π
That reminds me that getRandomNumber() would be a funny easter egg
https://xkcd.com/221/
This has been fixed in 210ec62 π
Most helpful comment
Are you sure? Maybe you were just (un)lucky? π