The only differences between randrange
and randint
that I know of are that with randrange([start], stop[, step])
you can pass a step
argument and random.randrange(0, 1)
will not consider the last item, while randint(0, 1)
returns a choice inclusive of the last item.
So, I don't understand why randrange(0, 1)
doesn't return 0
or 1
. Why would I use randrange(0, 2)
instead of a randrange(0, 1)
which does?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…