Download app/utils/randomizer.py from Jash05/test: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/spaces/Jash05/test/resolve/main/app/utils/randomizer.py
- Command line
-
hf download hf://spaces/Jash05/test/app/utils/randomizer.py
-
curl -L -o randomizer.py https://huggingface.co/spaces/Jash05/test/resolve/main/app/utils/randomizer.py
613 Bytes
| import random | |
| class SeededRandomizer: | |
| """Deterministic randomizer where one seed controls the full episode world.""" | |
| def __init__(self, seed: int): | |
| self.seed = seed | |
| random.seed(seed) | |
| self._rng = random.Random(seed) | |
| def random(self) -> float: | |
| return self._rng.random() | |
| def randint(self, low: int, high: int) -> int: | |
| return self._rng.randint(low, high) | |
| def uniform(self, low: float, high: float) -> float: | |
| return self._rng.uniform(low, high) | |
| def choice(self, values: list): | |
| return self._rng.choice(values) | |