randrange(self,
start,
stop=None)
Return a random integer from range(start, stop) . Note
that if only start is given, this will be the maximum
value that randrange will return. Otherwise the value will
be in the range [start, stop) . In other words,
stop will not be included in the result set.
Examples:
-
randrange(5) returns a random value from the set
(0, 1, 2, 3, 4)
-
randrange(2, 5) returns a randomvalue from the set
(2, 3, 4)
-
- Parameters:
start -
The minimum number (inclusive) of the random range if
stop is also given, otherwise the range is from
[0, start) if start is the only
parameter.
(type=int )
stop -
The end of the range (exclusive) of values that will be
returned. If this value is not given or is None ,
then start will be the end of the range.
(type=int )
- Returns:
-
A random integer from
range(start, stop) .
(type=int )
|