I was wondering if there is any reason not to use the //
operator to round a number to an integer. I didn't see much on this topic or really know what to look for to find out more.
>>> from random import random
>>> random() * 20 // 1
1.0
>>> random() * 20 // 1
0.0
>>> random() * 20 // 1
16.0
>>> random() * 20 // 1
11.0
>>> random() * 20 // 1
0.0
Besides needing to add 1 to the result (to not get a range of 1-20 instead of 0-19) Or does this actual result in the range 0-20?