random.randrange(stop)
random.randrange(start, stop[, step])
Return a randomly selected element from range(start, stop, step)
. This is equivalent to choice(range(start, stop, step))
, but doesn’t actually build a range object.
The positional argument pattern matches that of range()
. Keyword arguments should not be used because the function may use them in unexpected ways.
Changed in version 3.2: randrange()
is more sophisticated about producing equally distributed values. Formerly it used a style like int(random()*n)
which could produce slightly uneven distributions.
Please login to continue.