random.pyi 832 B

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