mtrand.pyi 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. import builtins
  2. from collections.abc import Callable
  3. from typing import Any, Literal, overload
  4. import numpy as np
  5. from numpy import (
  6. dtype,
  7. float64,
  8. int8,
  9. int16,
  10. int32,
  11. int64,
  12. int_,
  13. long,
  14. uint,
  15. uint8,
  16. uint16,
  17. uint32,
  18. uint64,
  19. ulong,
  20. )
  21. from numpy._typing import (
  22. ArrayLike,
  23. NDArray,
  24. _ArrayLikeFloat_co,
  25. _ArrayLikeInt_co,
  26. _DTypeLikeBool,
  27. _Int8Codes,
  28. _Int16Codes,
  29. _Int32Codes,
  30. _Int64Codes,
  31. _IntCodes,
  32. _LongCodes,
  33. _ShapeLike,
  34. _SupportsDType,
  35. _UInt8Codes,
  36. _UInt16Codes,
  37. _UInt32Codes,
  38. _UInt64Codes,
  39. _UIntCodes,
  40. _ULongCodes,
  41. )
  42. from numpy.random.bit_generator import BitGenerator
  43. __all__ = [
  44. "RandomState",
  45. "beta",
  46. "binomial",
  47. "bytes",
  48. "chisquare",
  49. "choice",
  50. "dirichlet",
  51. "exponential",
  52. "f",
  53. "gamma",
  54. "geometric",
  55. "get_bit_generator",
  56. "get_state",
  57. "gumbel",
  58. "hypergeometric",
  59. "laplace",
  60. "logistic",
  61. "lognormal",
  62. "logseries",
  63. "multinomial",
  64. "multivariate_normal",
  65. "negative_binomial",
  66. "noncentral_chisquare",
  67. "noncentral_f",
  68. "normal",
  69. "pareto",
  70. "permutation",
  71. "poisson",
  72. "power",
  73. "rand",
  74. "randint",
  75. "randn",
  76. "random",
  77. "random_integers",
  78. "random_sample",
  79. "ranf",
  80. "rayleigh",
  81. "sample",
  82. "seed",
  83. "set_bit_generator",
  84. "set_state",
  85. "shuffle",
  86. "standard_cauchy",
  87. "standard_exponential",
  88. "standard_gamma",
  89. "standard_normal",
  90. "standard_t",
  91. "triangular",
  92. "uniform",
  93. "vonmises",
  94. "wald",
  95. "weibull",
  96. "zipf",
  97. ]
  98. class RandomState:
  99. _bit_generator: BitGenerator
  100. def __init__(self, seed: _ArrayLikeInt_co | BitGenerator | None = ...) -> None: ...
  101. def __repr__(self) -> str: ...
  102. def __str__(self) -> str: ...
  103. def __getstate__(self) -> dict[str, Any]: ...
  104. def __setstate__(self, state: dict[str, Any]) -> None: ...
  105. def __reduce__(self) -> tuple[Callable[[BitGenerator], RandomState], tuple[BitGenerator], dict[str, Any]]: ... # noqa: E501
  106. def seed(self, seed: _ArrayLikeFloat_co | None = None) -> None: ...
  107. @overload
  108. def get_state(self, legacy: Literal[False] = False) -> dict[str, Any]: ...
  109. @overload
  110. def get_state(
  111. self, legacy: Literal[True] = True
  112. ) -> dict[str, Any] | tuple[str, NDArray[uint32], int, int, float]: ...
  113. def set_state(
  114. self, state: dict[str, Any] | tuple[str, NDArray[uint32], int, int, float]
  115. ) -> None: ...
  116. @overload
  117. def random_sample(self, size: None = None) -> float: ... # type: ignore[misc]
  118. @overload
  119. def random_sample(self, size: _ShapeLike) -> NDArray[float64]: ...
  120. @overload
  121. def random(self, size: None = None) -> float: ... # type: ignore[misc]
  122. @overload
  123. def random(self, size: _ShapeLike) -> NDArray[float64]: ...
  124. @overload
  125. def beta(self, a: float, b: float, size: None = None) -> float: ... # type: ignore[misc]
  126. @overload
  127. def beta(
  128. self,
  129. a: _ArrayLikeFloat_co,
  130. b: _ArrayLikeFloat_co,
  131. size: _ShapeLike | None = None
  132. ) -> NDArray[float64]: ...
  133. @overload
  134. def exponential(self, scale: float = 1.0, size: None = None) -> float: ... # type: ignore[misc]
  135. @overload
  136. def exponential(
  137. self, scale: _ArrayLikeFloat_co = 1.0, size: _ShapeLike | None = None
  138. ) -> NDArray[float64]: ...
  139. @overload
  140. def standard_exponential(self, size: None = None) -> float: ... # type: ignore[misc]
  141. @overload
  142. def standard_exponential(self, size: _ShapeLike) -> NDArray[float64]: ...
  143. @overload
  144. def tomaxint(self, size: None = None) -> int: ... # type: ignore[misc]
  145. @overload
  146. # Generates long values, but stores it in a 64bit int:
  147. def tomaxint(self, size: _ShapeLike) -> NDArray[int64]: ...
  148. @overload
  149. def randint( # type: ignore[misc]
  150. self,
  151. low: int,
  152. high: int | None = None,
  153. size: None = None,
  154. ) -> int: ...
  155. @overload
  156. def randint( # type: ignore[misc]
  157. self,
  158. low: int,
  159. high: int | None = None,
  160. size: None = None,
  161. dtype: type[bool] = ...,
  162. ) -> bool: ...
  163. @overload
  164. def randint( # type: ignore[misc]
  165. self,
  166. low: int,
  167. high: int | None = None,
  168. size: None = None,
  169. dtype: type[np.bool] = ...,
  170. ) -> np.bool: ...
  171. @overload
  172. def randint( # type: ignore[misc]
  173. self,
  174. low: int,
  175. high: int | None = None,
  176. size: None = None,
  177. dtype: type[int] = ...,
  178. ) -> int: ...
  179. @overload
  180. def randint( # type: ignore[misc]
  181. self,
  182. low: int,
  183. high: int | None = None,
  184. size: None = None,
  185. dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., # noqa: E501
  186. ) -> uint8: ...
  187. @overload
  188. def randint( # type: ignore[misc]
  189. self,
  190. low: int,
  191. high: int | None = None,
  192. size: None = None,
  193. dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., # noqa: E501
  194. ) -> uint16: ...
  195. @overload
  196. def randint( # type: ignore[misc]
  197. self,
  198. low: int,
  199. high: int | None = None,
  200. size: None = None,
  201. dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., # noqa: E501
  202. ) -> uint32: ...
  203. @overload
  204. def randint( # type: ignore[misc]
  205. self,
  206. low: int,
  207. high: int | None = None,
  208. size: None = None,
  209. dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ..., # noqa: E501
  210. ) -> uint: ...
  211. @overload
  212. def randint( # type: ignore[misc]
  213. self,
  214. low: int,
  215. high: int | None = None,
  216. size: None = None,
  217. dtype: dtype[ulong] | type[ulong] | _ULongCodes | _SupportsDType[dtype[ulong]] = ..., # noqa: E501
  218. ) -> ulong: ...
  219. @overload
  220. def randint( # type: ignore[misc]
  221. self,
  222. low: int,
  223. high: int | None = None,
  224. size: None = None,
  225. dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., # noqa: E501
  226. ) -> uint64: ...
  227. @overload
  228. def randint( # type: ignore[misc]
  229. self,
  230. low: int,
  231. high: int | None = None,
  232. size: None = None,
  233. dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., # noqa: E501
  234. ) -> int8: ...
  235. @overload
  236. def randint( # type: ignore[misc]
  237. self,
  238. low: int,
  239. high: int | None = None,
  240. size: None = None,
  241. dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., # noqa: E501
  242. ) -> int16: ...
  243. @overload
  244. def randint( # type: ignore[misc]
  245. self,
  246. low: int,
  247. high: int | None = None,
  248. size: None = None,
  249. dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., # noqa: E501
  250. ) -> int32: ...
  251. @overload
  252. def randint( # type: ignore[misc]
  253. self,
  254. low: int,
  255. high: int | None = None,
  256. size: None = None,
  257. dtype: dtype[int_] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ..., # noqa: E501
  258. ) -> int_: ...
  259. @overload
  260. def randint( # type: ignore[misc]
  261. self,
  262. low: int,
  263. high: int | None = None,
  264. size: None = None,
  265. dtype: dtype[long] | type[long] | _LongCodes | _SupportsDType[dtype[long]] = ..., # noqa: E501
  266. ) -> long: ...
  267. @overload
  268. def randint( # type: ignore[misc]
  269. self,
  270. low: int,
  271. high: int | None = None,
  272. size: None = None,
  273. dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ..., # noqa: E501
  274. ) -> int64: ...
  275. @overload
  276. def randint( # type: ignore[misc]
  277. self,
  278. low: _ArrayLikeInt_co,
  279. high: _ArrayLikeInt_co | None = None,
  280. size: _ShapeLike | None = None,
  281. ) -> NDArray[long]: ...
  282. @overload
  283. def randint( # type: ignore[misc]
  284. self,
  285. low: _ArrayLikeInt_co,
  286. high: _ArrayLikeInt_co | None = None,
  287. size: _ShapeLike | None = None,
  288. dtype: _DTypeLikeBool = ...,
  289. ) -> NDArray[np.bool]: ...
  290. @overload
  291. def randint( # type: ignore[misc]
  292. self,
  293. low: _ArrayLikeInt_co,
  294. high: _ArrayLikeInt_co | None = None,
  295. size: _ShapeLike | None = None,
  296. dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., # noqa: E501
  297. ) -> NDArray[int8]: ...
  298. @overload
  299. def randint( # type: ignore[misc]
  300. self,
  301. low: _ArrayLikeInt_co,
  302. high: _ArrayLikeInt_co | None = None,
  303. size: _ShapeLike | None = None,
  304. dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., # noqa: E501
  305. ) -> NDArray[int16]: ...
  306. @overload
  307. def randint( # type: ignore[misc]
  308. self,
  309. low: _ArrayLikeInt_co,
  310. high: _ArrayLikeInt_co | None = None,
  311. size: _ShapeLike | None = None,
  312. dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., # noqa: E501
  313. ) -> NDArray[int32]: ...
  314. @overload
  315. def randint( # type: ignore[misc]
  316. self,
  317. low: _ArrayLikeInt_co,
  318. high: _ArrayLikeInt_co | None = None,
  319. size: _ShapeLike | None = None,
  320. dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] | None = ..., # noqa: E501
  321. ) -> NDArray[int64]: ...
  322. @overload
  323. def randint( # type: ignore[misc]
  324. self,
  325. low: _ArrayLikeInt_co,
  326. high: _ArrayLikeInt_co | None = None,
  327. size: _ShapeLike | None = None,
  328. dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., # noqa: E501
  329. ) -> NDArray[uint8]: ...
  330. @overload
  331. def randint( # type: ignore[misc]
  332. self,
  333. low: _ArrayLikeInt_co,
  334. high: _ArrayLikeInt_co | None = None,
  335. size: _ShapeLike | None = None,
  336. dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., # noqa: E501
  337. ) -> NDArray[uint16]: ...
  338. @overload
  339. def randint( # type: ignore[misc]
  340. self,
  341. low: _ArrayLikeInt_co,
  342. high: _ArrayLikeInt_co | None = None,
  343. size: _ShapeLike | None = None,
  344. dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., # noqa: E501
  345. ) -> NDArray[uint32]: ...
  346. @overload
  347. def randint( # type: ignore[misc]
  348. self,
  349. low: _ArrayLikeInt_co,
  350. high: _ArrayLikeInt_co | None = None,
  351. size: _ShapeLike | None = None,
  352. dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., # noqa: E501
  353. ) -> NDArray[uint64]: ...
  354. @overload
  355. def randint( # type: ignore[misc]
  356. self,
  357. low: _ArrayLikeInt_co,
  358. high: _ArrayLikeInt_co | None = None,
  359. size: _ShapeLike | None = None,
  360. dtype: dtype[long] | type[int] | type[long] | _LongCodes | _SupportsDType[dtype[long]] = ..., # noqa: E501
  361. ) -> NDArray[long]: ...
  362. @overload
  363. def randint( # type: ignore[misc]
  364. self,
  365. low: _ArrayLikeInt_co,
  366. high: _ArrayLikeInt_co | None = None,
  367. size: _ShapeLike | None = None,
  368. dtype: dtype[ulong] | type[ulong] | _ULongCodes | _SupportsDType[dtype[ulong]] = ..., # noqa: E501
  369. ) -> NDArray[ulong]: ...
  370. def bytes(self, length: int) -> builtins.bytes: ...
  371. @overload
  372. def choice(
  373. self,
  374. a: int,
  375. size: None = None,
  376. replace: bool = True,
  377. p: _ArrayLikeFloat_co | None = None,
  378. ) -> int: ...
  379. @overload
  380. def choice(
  381. self,
  382. a: int,
  383. size: _ShapeLike | None = None,
  384. replace: bool = True,
  385. p: _ArrayLikeFloat_co | None = None,
  386. ) -> NDArray[long]: ...
  387. @overload
  388. def choice(
  389. self,
  390. a: ArrayLike,
  391. size: None = None,
  392. replace: bool = True,
  393. p: _ArrayLikeFloat_co | None = None,
  394. ) -> Any: ...
  395. @overload
  396. def choice(
  397. self,
  398. a: ArrayLike,
  399. size: _ShapeLike | None = None,
  400. replace: bool = True,
  401. p: _ArrayLikeFloat_co | None = None,
  402. ) -> NDArray[Any]: ...
  403. @overload
  404. def uniform(
  405. self, low: float = 0.0, high: float = 1.0, size: None = None
  406. ) -> float: ... # type: ignore[misc]
  407. @overload
  408. def uniform(
  409. self,
  410. low: _ArrayLikeFloat_co = 0.0,
  411. high: _ArrayLikeFloat_co = 1.0,
  412. size: _ShapeLike | None = None,
  413. ) -> NDArray[float64]: ...
  414. @overload
  415. def rand(self) -> float: ...
  416. @overload
  417. def rand(self, *args: int) -> NDArray[float64]: ...
  418. @overload
  419. def randn(self) -> float: ...
  420. @overload
  421. def randn(self, *args: int) -> NDArray[float64]: ...
  422. @overload
  423. def random_integers(
  424. self, low: int, high: int | None = None, size: None = None
  425. ) -> int: ... # type: ignore[misc]
  426. @overload
  427. def random_integers(
  428. self,
  429. low: _ArrayLikeInt_co,
  430. high: _ArrayLikeInt_co | None = None,
  431. size: _ShapeLike | None = None,
  432. ) -> NDArray[long]: ...
  433. @overload
  434. def standard_normal(self, size: None = None) -> float: ... # type: ignore[misc]
  435. @overload
  436. def standard_normal( # type: ignore[misc]
  437. self, size: _ShapeLike | None = None
  438. ) -> NDArray[float64]: ...
  439. @overload
  440. def normal(
  441. self, loc: float = 0.0, scale: float = 1.0, size: None = None
  442. ) -> float: ... # type: ignore[misc]
  443. @overload
  444. def normal(
  445. self,
  446. loc: _ArrayLikeFloat_co = 0.0,
  447. scale: _ArrayLikeFloat_co = 1.0,
  448. size: _ShapeLike | None = None,
  449. ) -> NDArray[float64]: ...
  450. @overload
  451. def standard_gamma( # type: ignore[misc]
  452. self,
  453. shape: float,
  454. size: None = None,
  455. ) -> float: ...
  456. @overload
  457. def standard_gamma(
  458. self,
  459. shape: _ArrayLikeFloat_co,
  460. size: _ShapeLike | None = None,
  461. ) -> NDArray[float64]: ...
  462. @overload
  463. def gamma(self, shape: float, scale: float = 1.0, size: None = None) -> float: ... # type: ignore[misc]
  464. @overload
  465. def gamma(
  466. self,
  467. shape: _ArrayLikeFloat_co,
  468. scale: _ArrayLikeFloat_co = 1.0,
  469. size: _ShapeLike | None = None,
  470. ) -> NDArray[float64]: ...
  471. @overload
  472. def f(self, dfnum: float, dfden: float, size: None = None) -> float: ... # type: ignore[misc]
  473. @overload
  474. def f(
  475. self,
  476. dfnum: _ArrayLikeFloat_co,
  477. dfden: _ArrayLikeFloat_co,
  478. size: _ShapeLike | None = None
  479. ) -> NDArray[float64]: ...
  480. @overload
  481. def noncentral_f(
  482. self, dfnum: float, dfden: float, nonc: float, size: None = None
  483. ) -> float: ... # type: ignore[misc]
  484. @overload
  485. def noncentral_f(
  486. self,
  487. dfnum: _ArrayLikeFloat_co,
  488. dfden: _ArrayLikeFloat_co,
  489. nonc: _ArrayLikeFloat_co,
  490. size: _ShapeLike | None = None,
  491. ) -> NDArray[float64]: ...
  492. @overload
  493. def chisquare(self, df: float, size: None = None) -> float: ... # type: ignore[misc]
  494. @overload
  495. def chisquare(
  496. self, df: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  497. ) -> NDArray[float64]: ...
  498. @overload
  499. def noncentral_chisquare(
  500. self, df: float, nonc: float, size: None = None
  501. ) -> float: ... # type: ignore[misc]
  502. @overload
  503. def noncentral_chisquare(
  504. self,
  505. df: _ArrayLikeFloat_co,
  506. nonc: _ArrayLikeFloat_co,
  507. size: _ShapeLike | None = None
  508. ) -> NDArray[float64]: ...
  509. @overload
  510. def standard_t(self, df: float, size: None = None) -> float: ... # type: ignore[misc]
  511. @overload
  512. def standard_t(
  513. self, df: _ArrayLikeFloat_co, size: None = None
  514. ) -> NDArray[float64]: ...
  515. @overload
  516. def standard_t(
  517. self, df: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  518. ) -> NDArray[float64]: ...
  519. @overload
  520. def vonmises(self, mu: float, kappa: float, size: None = None) -> float: ... # type: ignore[misc]
  521. @overload
  522. def vonmises(
  523. self,
  524. mu: _ArrayLikeFloat_co,
  525. kappa: _ArrayLikeFloat_co,
  526. size: _ShapeLike | None = None
  527. ) -> NDArray[float64]: ...
  528. @overload
  529. def pareto(self, a: float, size: None = None) -> float: ... # type: ignore[misc]
  530. @overload
  531. def pareto(
  532. self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  533. ) -> NDArray[float64]: ...
  534. @overload
  535. def weibull(self, a: float, size: None = None) -> float: ... # type: ignore[misc]
  536. @overload
  537. def weibull(
  538. self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  539. ) -> NDArray[float64]: ...
  540. @overload
  541. def power(self, a: float, size: None = None) -> float: ... # type: ignore[misc]
  542. @overload
  543. def power(
  544. self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  545. ) -> NDArray[float64]: ...
  546. @overload
  547. def standard_cauchy(self, size: None = None) -> float: ... # type: ignore[misc]
  548. @overload
  549. def standard_cauchy(self, size: _ShapeLike | None = None) -> NDArray[float64]: ...
  550. @overload
  551. def laplace(
  552. self, loc: float = 0.0, scale: float = 1.0, size: None = None
  553. ) -> float: ... # type: ignore[misc]
  554. @overload
  555. def laplace(
  556. self,
  557. loc: _ArrayLikeFloat_co = 0.0,
  558. scale: _ArrayLikeFloat_co = 1.0,
  559. size: _ShapeLike | None = None,
  560. ) -> NDArray[float64]: ...
  561. @overload
  562. def gumbel(
  563. self, loc: float = 0.0, scale: float = 1.0, size: None = None
  564. ) -> float: ... # type: ignore[misc]
  565. @overload
  566. def gumbel(
  567. self,
  568. loc: _ArrayLikeFloat_co = 0.0,
  569. scale: _ArrayLikeFloat_co = 1.0,
  570. size: _ShapeLike | None = None,
  571. ) -> NDArray[float64]: ...
  572. @overload
  573. def logistic(
  574. self, loc: float = 0.0, scale: float = 1.0, size: None = None
  575. ) -> float: ... # type: ignore[misc]
  576. @overload
  577. def logistic(
  578. self,
  579. loc: _ArrayLikeFloat_co = 0.0,
  580. scale: _ArrayLikeFloat_co = 1.0,
  581. size: _ShapeLike | None = None,
  582. ) -> NDArray[float64]: ...
  583. @overload
  584. def lognormal(
  585. self, mean: float = 0.0, sigma: float = 1.0, size: None = None
  586. ) -> float: ... # type: ignore[misc]
  587. @overload
  588. def lognormal(
  589. self,
  590. mean: _ArrayLikeFloat_co = 0.0,
  591. sigma: _ArrayLikeFloat_co = 1.0,
  592. size: _ShapeLike | None = None,
  593. ) -> NDArray[float64]: ...
  594. @overload
  595. def rayleigh(self, scale: float = 1.0, size: None = None) -> float: ... # type: ignore[misc]
  596. @overload
  597. def rayleigh(
  598. self, scale: _ArrayLikeFloat_co = 1.0, size: _ShapeLike | None = None
  599. ) -> NDArray[float64]: ...
  600. @overload
  601. def wald(self, mean: float, scale: float, size: None = None) -> float: ... # type: ignore[misc]
  602. @overload
  603. def wald(
  604. self,
  605. mean: _ArrayLikeFloat_co,
  606. scale: _ArrayLikeFloat_co,
  607. size: _ShapeLike | None = None
  608. ) -> NDArray[float64]: ...
  609. @overload
  610. def triangular(
  611. self, left: float, mode: float, right: float, size: None = None
  612. ) -> float: ... # type: ignore[misc]
  613. @overload
  614. def triangular(
  615. self,
  616. left: _ArrayLikeFloat_co,
  617. mode: _ArrayLikeFloat_co,
  618. right: _ArrayLikeFloat_co,
  619. size: _ShapeLike | None = None,
  620. ) -> NDArray[float64]: ...
  621. @overload
  622. def binomial(
  623. self, n: int, p: float, size: None = None
  624. ) -> int: ... # type: ignore[misc]
  625. @overload
  626. def binomial(
  627. self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  628. ) -> NDArray[long]: ...
  629. @overload
  630. def negative_binomial(
  631. self, n: float, p: float, size: None = None
  632. ) -> int: ... # type: ignore[misc]
  633. @overload
  634. def negative_binomial(
  635. self,
  636. n: _ArrayLikeFloat_co,
  637. p: _ArrayLikeFloat_co,
  638. size: _ShapeLike | None = None
  639. ) -> NDArray[long]: ...
  640. @overload
  641. def poisson(
  642. self, lam: float = 1.0, size: None = None
  643. ) -> int: ... # type: ignore[misc]
  644. @overload
  645. def poisson(
  646. self, lam: _ArrayLikeFloat_co = 1.0, size: _ShapeLike | None = None
  647. ) -> NDArray[long]: ...
  648. @overload
  649. def zipf(self, a: float, size: None = None) -> int: ... # type: ignore[misc]
  650. @overload
  651. def zipf(
  652. self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  653. ) -> NDArray[long]: ...
  654. @overload
  655. def geometric(self, p: float, size: None = None) -> int: ... # type: ignore[misc]
  656. @overload
  657. def geometric(
  658. self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  659. ) -> NDArray[long]: ...
  660. @overload
  661. def hypergeometric(
  662. self, ngood: int, nbad: int, nsample: int, size: None = None
  663. ) -> int: ... # type: ignore[misc]
  664. @overload
  665. def hypergeometric(
  666. self,
  667. ngood: _ArrayLikeInt_co,
  668. nbad: _ArrayLikeInt_co,
  669. nsample: _ArrayLikeInt_co,
  670. size: _ShapeLike | None = None,
  671. ) -> NDArray[long]: ...
  672. @overload
  673. def logseries(self, p: float, size: None = None) -> int: ... # type: ignore[misc]
  674. @overload
  675. def logseries(
  676. self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  677. ) -> NDArray[long]: ...
  678. def multivariate_normal(
  679. self,
  680. mean: _ArrayLikeFloat_co,
  681. cov: _ArrayLikeFloat_co,
  682. size: _ShapeLike | None = None,
  683. check_valid: Literal["warn", "raise", "ignore"] = "warn",
  684. tol: float = 1e-8,
  685. ) -> NDArray[float64]: ...
  686. def multinomial(
  687. self, n: _ArrayLikeInt_co,
  688. pvals: _ArrayLikeFloat_co,
  689. size: _ShapeLike | None = None
  690. ) -> NDArray[long]: ...
  691. def dirichlet(
  692. self, alpha: _ArrayLikeFloat_co, size: _ShapeLike | None = None
  693. ) -> NDArray[float64]: ...
  694. def shuffle(self, x: ArrayLike) -> None: ...
  695. @overload
  696. def permutation(self, x: int) -> NDArray[long]: ...
  697. @overload
  698. def permutation(self, x: ArrayLike) -> NDArray[Any]: ...
  699. _rand: RandomState
  700. beta = _rand.beta
  701. binomial = _rand.binomial
  702. bytes = _rand.bytes
  703. chisquare = _rand.chisquare
  704. choice = _rand.choice
  705. dirichlet = _rand.dirichlet
  706. exponential = _rand.exponential
  707. f = _rand.f
  708. gamma = _rand.gamma
  709. get_state = _rand.get_state
  710. geometric = _rand.geometric
  711. gumbel = _rand.gumbel
  712. hypergeometric = _rand.hypergeometric
  713. laplace = _rand.laplace
  714. logistic = _rand.logistic
  715. lognormal = _rand.lognormal
  716. logseries = _rand.logseries
  717. multinomial = _rand.multinomial
  718. multivariate_normal = _rand.multivariate_normal
  719. negative_binomial = _rand.negative_binomial
  720. noncentral_chisquare = _rand.noncentral_chisquare
  721. noncentral_f = _rand.noncentral_f
  722. normal = _rand.normal
  723. pareto = _rand.pareto
  724. permutation = _rand.permutation
  725. poisson = _rand.poisson
  726. power = _rand.power
  727. rand = _rand.rand
  728. randint = _rand.randint
  729. randn = _rand.randn
  730. random = _rand.random
  731. random_integers = _rand.random_integers
  732. random_sample = _rand.random_sample
  733. rayleigh = _rand.rayleigh
  734. seed = _rand.seed
  735. set_state = _rand.set_state
  736. shuffle = _rand.shuffle
  737. standard_cauchy = _rand.standard_cauchy
  738. standard_exponential = _rand.standard_exponential
  739. standard_gamma = _rand.standard_gamma
  740. standard_normal = _rand.standard_normal
  741. standard_t = _rand.standard_t
  742. triangular = _rand.triangular
  743. uniform = _rand.uniform
  744. vonmises = _rand.vonmises
  745. wald = _rand.wald
  746. weibull = _rand.weibull
  747. zipf = _rand.zipf
  748. # Two legacy that are trivial wrappers around random_sample
  749. sample = _rand.random_sample
  750. ranf = _rand.random_sample
  751. def set_bit_generator(bitgen: BitGenerator) -> None: ...
  752. def get_bit_generator() -> BitGenerator: ...