Skip to content

Commit 1875423

Browse files
committed
Write the test for random.randrange()
1 parent e3b7ec8 commit 1875423

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

integration_tests/test_random.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ def test_random():
1111
print(r)
1212
assert r >= 0.0 and r < 1.0
1313

14+
def test_randrange():
15+
r: i32
16+
r = random.randrange(0, 10) # [0, 10)
17+
print(r)
18+
assert r >= 0 and r < 10
19+
r = random.randrange(-50, 76) # [-50, 76)
20+
print(r)
21+
assert r >= -50 and r < 76
22+
1423
def test_randint():
1524
ri1: i32
1625
ri2: i32
@@ -29,5 +38,6 @@ def test_paretovariate():
2938
print(r)
3039

3140
test_random()
41+
test_randrange()
3242
test_randint()
3343
test_paretovariate()

0 commit comments

Comments
 (0)