How to use 'randrange python 3' in Python

Every line of 'randrange python 3' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
87def randrange(start, stop=None, step=1):
88 """Choose a random item from range(start, stop[, step]).
89
90 This fixes the problem with randint() which includes the
91 endpoint; in Python this is usually not what you want.
92
93 EXAMPLES:
94 sage: randrange(0, 100, 11)
95 11
96 sage: randrange(5000, 5100)
97 5051
98 sage: [randrange(0, 2) for i in range(15)]
99 [0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1]
100 sage: randrange(0, 1000000, 1000)
101 486000
102 sage: randrange(-100, 10)
103 -56
104 """
105 return _pyrand().randrange(start, stop, step)

Related snippets