| 1 |
from typing import Callable, Tuple, Union, Sequence, Any, Optional, TypeVar |
| 2 |
|
| 3 |
__all__ = ['StrongRandom', 'getrandbits', 'randrange', 'randint', 'choice', 'shuffle', 'sample'] |
| 4 |
|
| 5 |
T = TypeVar('T') |
| 6 |
|
| 7 |
class StrongRandom(object): |
| 8 |
def __init__(self, rng: Optional[Any]=None, randfunc: Optional[Callable]=None) -> None: ... |
| 9 |
def getrandbits(self, k: int) -> int: ... |
| 10 |
def randrange(self, start: int, stop: int = ..., step: int = ...) -> int: ... |
| 11 |
def randint(self, a: int, b: int) -> int: ... |
| 12 |
def choice(self, seq: Sequence[T]) -> T: ... |
| 13 |
def shuffle(self, x: Sequence) -> None: ... |
| 14 |
def sample(self, population: Sequence, k: int) -> list: ... |
| 15 |
|
| 16 |
_r = StrongRandom() |
| 17 |
getrandbits = _r.getrandbits |
| 18 |
randrange = _r.randrange |
| 19 |
randint = _r.randint |
| 20 |
choice = _r.choice |
| 21 |
shuffle = _r.shuffle |
| 22 |
sample = _r.sample |