3 from collections.abc import Callable, Iterable, MutableSequence, Sequence
4 from fractions import Fraction
5 from typing import Any, NoReturn, Tuple, TypeVar
9 class Random(_random.Random):
10 def __init__(self, x: Any = ...) -> None: ...
11 def seed(self, a: Any = ..., version: int = ...) -> None: ...
12 def getstate(self) -> Tuple[Any, ...]: ...
13 def setstate(self, state: Tuple[Any, ...]) -> None: ...
14 def getrandbits(self, __k: int) -> int: ...
15 def randrange(self, start: int, stop: int | None = ..., step: int = ...) -> int: ...
16 def randint(self, a: int, b: int) -> int: ...
17 if sys.version_info >= (3, 9):
18 def randbytes(self, n: int) -> bytes: ...
19 def choice(self, seq: Sequence[_T]) -> _T: ...
22 population: Sequence[_T],
23 weights: Sequence[float | Fraction] | None = ...,
25 cum_weights: Sequence[float | Fraction] | None = ...,
28 def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
29 if sys.version_info >= (3, 9):
30 def sample(self, population: Sequence[_T] | set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
32 def sample(self, population: Sequence[_T] | set[_T], k: int) -> list[_T]: ...
33 def random(self) -> float: ...
34 def uniform(self, a: float, b: float) -> float: ...
35 def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
36 def betavariate(self, alpha: float, beta: float) -> float: ...
37 def expovariate(self, lambd: float) -> float: ...
38 def gammavariate(self, alpha: float, beta: float) -> float: ...
39 def gauss(self, mu: float, sigma: float) -> float: ...
40 def lognormvariate(self, mu: float, sigma: float) -> float: ...
41 def normalvariate(self, mu: float, sigma: float) -> float: ...
42 def vonmisesvariate(self, mu: float, kappa: float) -> float: ...
43 def paretovariate(self, alpha: float) -> float: ...
44 def weibullvariate(self, alpha: float, beta: float) -> float: ...
46 # SystemRandom is not implemented for all OS's; good on Windows & Linux
47 class SystemRandom(Random):
48 def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
49 def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
51 # ----- random function stubs -----
52 def seed(a: Any = ..., version: int = ...) -> None: ...
53 def getstate() -> object: ...
54 def setstate(state: object) -> None: ...
55 def getrandbits(__k: int) -> int: ...
56 def randrange(start: int, stop: None | int = ..., step: int = ...) -> int: ...
57 def randint(a: int, b: int) -> int: ...
59 if sys.version_info >= (3, 9):
60 def randbytes(n: int) -> bytes: ...
62 def choice(seq: Sequence[_T]) -> _T: ...
64 population: Sequence[_T], weights: Sequence[float] | None = ..., *, cum_weights: Sequence[float] | None = ..., k: int = ...
66 def shuffle(x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
68 if sys.version_info >= (3, 9):
69 def sample(population: Sequence[_T] | set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
72 def sample(population: Sequence[_T] | set[_T], k: int) -> list[_T]: ...
74 def random() -> float: ...
75 def uniform(a: float, b: float) -> float: ...
76 def triangular(low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
77 def betavariate(alpha: float, beta: float) -> float: ...
78 def expovariate(lambd: float) -> float: ...
79 def gammavariate(alpha: float, beta: float) -> float: ...
80 def gauss(mu: float, sigma: float) -> float: ...
81 def lognormvariate(mu: float, sigma: float) -> float: ...
82 def normalvariate(mu: float, sigma: float) -> float: ...
83 def vonmisesvariate(mu: float, kappa: float) -> float: ...
84 def paretovariate(alpha: float) -> float: ...
85 def weibullvariate(alpha: float, beta: float) -> float: ...