Introducing randrange([start,] stop [,step]) -- same as
choice(range(start, stop, step)) but faster.  This addresses the
problem that randint() was accidentally defined as taking an inclusive
range (how unpythonic).

The code is longish because Tim Peters insisted that it reject
non-integral arguments while I insisted that it be not much slower
than randint(); the compromise satisfies both but is somewhat
convoluted.

Also changed randint() to be implemented through randrange().  This is
a semantic change because old randint() didn't test its arguments for
validity.  (It also makes randrange() win any contest with randint()
:-)
1 file changed