diff --git a/stdlib/3/random.pyi b/stdlib/3/random.pyi index f40d97320..e32f1bb6e 100644 --- a/stdlib/3/random.pyi +++ b/stdlib/3/random.pyi @@ -7,8 +7,9 @@ # ----- random classes ----- import _random +import sys from typing import ( - Any, TypeVar, Sequence, List, Callable, AbstractSet, Union + Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, Optional ) _T = TypeVar('_T') @@ -50,6 +51,8 @@ def getrandbits(k: int) -> int: ... def randrange(start: int, stop: Union[None, int] = ..., step: int = ...) -> int: ... def randint(a: int, b: int) -> int: ... def choice(seq: Sequence[_T]) -> _T: ... +if sys.version_info >= (3, 6): + def choices(population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ... def shuffle(x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ... def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... def random() -> float: ...