MCPcopy Index your code
hub / github.com/RustPython/RustPython / randbelow

Function randbelow

Lib/secrets.py:25–29  ·  view source on GitHub ↗

Return a random int in the range [0, n).

(exclusive_upper_bound)

Source from the content-addressed store, hash-verified

23choice = _sysrand.choice
24
25def randbelow(exclusive_upper_bound):
26 """Return a random int in the range [0, n)."""
27 if exclusive_upper_bound <= 0:
28 raise ValueError("Upper bound must be positive.")
29 return _sysrand._randbelow(exclusive_upper_bound)
30
31DEFAULT_ENTROPY = 32 # number of bytes to return by default
32

Callers 2

shuffleMethod · 0.85
sampleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected