| 380 | return a + (b - a) * self._rng.random() |
| 381 | |
| 382 | def randrange(self, a, b=None): |
| 383 | import numpy as np |
| 384 | |
| 385 | if b is None: |
| 386 | a, b = 0, a |
| 387 | if b > 9223372036854775807: # from np.iinfo(np.int64).max |
| 388 | tmp_rng = PythonRandomViaNumpyBits(self._rng) |
| 389 | return tmp_rng.randrange(a, b) |
| 390 | |
| 391 | if isinstance(self._rng, np.random.Generator): |
| 392 | return self._rng.integers(a, b) |
| 393 | return self._rng.randint(a, b) |
| 394 | |
| 395 | # NOTE: the numpy implementations of `choice` don't support strings, so |
| 396 | # this cannot be replaced with self._rng.choice |