MCPcopy Index your code
hub / github.com/python/cpython / randint

Method randint

Lib/random.py:335–342  ·  view source on GitHub ↗

Return random integer in range [a, b], including both end points.

(self, a, b)

Source from the content-addressed store, hash-verified

333 return istart + istep * self._randbelow(n)
334
335 def randint(self, a, b):
336 """Return random integer in range [a, b], including both end points.
337 """
338 a = _index(a)
339 b = _index(b)
340 if b < a:
341 raise ValueError(f"empty range in randint({a}, {b})")
342 return a + self._randbelow(b - a + 1)
343
344
345 ## -------------------- sequence methods -------------------

Callers 15

_connectMethod · 0.80
getran2Method · 0.80
pop_and_collectMethod · 0.80
setUpModuleFunction · 0.80
test_tellMethod · 0.80
test_error_msgMethod · 0.80
_check_random_seedMethod · 0.80
__init__Method · 0.80
parse_ivMethod · 0.80
remove_loopMethod · 0.80

Calls 1

_indexFunction · 0.85

Tested by 15

getran2Method · 0.64
pop_and_collectMethod · 0.64
setUpModuleFunction · 0.64
test_tellMethod · 0.64
test_error_msgMethod · 0.64
_check_random_seedMethod · 0.64
__init__Method · 0.64
parse_ivMethod · 0.64
remove_loopMethod · 0.64
test_floatasratioMethod · 0.64