Download src/utils/number.py from kbl2810/test: direct link, hf CLI and curl.
- Browser
- Download file 242 Bytes
-
https://huggingface.co/spaces/kbl2810/test/resolve/main/src/utils/number.py
- Command line
-
hf download hf://spaces/kbl2810/test/src/utils/number.py
-
curl -L -o number.py https://huggingface.co/spaces/kbl2810/test/resolve/main/src/utils/number.py
242 Bytes
| import random | |
| def rand_exclude(a: int, b: int, c: int) -> int: | |
| if c < a or c > b: | |
| return random.randint(a, b) | |
| count = (b - a + 1) - 1 | |
| r = random.randint(0, count - 1) | |
| if r >= (c - a): | |
| r += 1 | |
| return a + r | |