random.pyi 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import numpy as np
  2. from typing import Any
  3. SEED_FLOAT: float = 457.3
  4. SEED_ARR_FLOAT: np.ndarray[Any, np.dtype[np.float64]] = np.array([1.0, 2, 3, 4])
  5. SEED_ARRLIKE_FLOAT: list[float] = [1.0, 2.0, 3.0, 4.0]
  6. SEED_SEED_SEQ: np.random.SeedSequence = np.random.SeedSequence(0)
  7. SEED_STR: str = "String seeding not allowed"
  8. # default rng
  9. np.random.default_rng(SEED_FLOAT) # E: incompatible type
  10. np.random.default_rng(SEED_ARR_FLOAT) # E: incompatible type
  11. np.random.default_rng(SEED_ARRLIKE_FLOAT) # E: incompatible type
  12. np.random.default_rng(SEED_STR) # E: incompatible type
  13. # Seed Sequence
  14. np.random.SeedSequence(SEED_FLOAT) # E: incompatible type
  15. np.random.SeedSequence(SEED_ARR_FLOAT) # E: incompatible type
  16. np.random.SeedSequence(SEED_ARRLIKE_FLOAT) # E: incompatible type
  17. np.random.SeedSequence(SEED_SEED_SEQ) # E: incompatible type
  18. np.random.SeedSequence(SEED_STR) # E: incompatible type
  19. seed_seq: np.random.bit_generator.SeedSequence = np.random.SeedSequence()
  20. seed_seq.spawn(11.5) # E: incompatible type
  21. seed_seq.generate_state(3.14) # E: incompatible type
  22. seed_seq.generate_state(3, np.uint8) # E: incompatible type
  23. seed_seq.generate_state(3, "uint8") # E: incompatible type
  24. seed_seq.generate_state(3, "u1") # E: incompatible type
  25. seed_seq.generate_state(3, np.uint16) # E: incompatible type
  26. seed_seq.generate_state(3, "uint16") # E: incompatible type
  27. seed_seq.generate_state(3, "u2") # E: incompatible type
  28. seed_seq.generate_state(3, np.int32) # E: incompatible type
  29. seed_seq.generate_state(3, "int32") # E: incompatible type
  30. seed_seq.generate_state(3, "i4") # E: incompatible type
  31. # Bit Generators
  32. np.random.MT19937(SEED_FLOAT) # E: incompatible type
  33. np.random.MT19937(SEED_ARR_FLOAT) # E: incompatible type
  34. np.random.MT19937(SEED_ARRLIKE_FLOAT) # E: incompatible type
  35. np.random.MT19937(SEED_STR) # E: incompatible type
  36. np.random.PCG64(SEED_FLOAT) # E: incompatible type
  37. np.random.PCG64(SEED_ARR_FLOAT) # E: incompatible type
  38. np.random.PCG64(SEED_ARRLIKE_FLOAT) # E: incompatible type
  39. np.random.PCG64(SEED_STR) # E: incompatible type
  40. np.random.Philox(SEED_FLOAT) # E: incompatible type
  41. np.random.Philox(SEED_ARR_FLOAT) # E: incompatible type
  42. np.random.Philox(SEED_ARRLIKE_FLOAT) # E: incompatible type
  43. np.random.Philox(SEED_STR) # E: incompatible type
  44. np.random.SFC64(SEED_FLOAT) # E: incompatible type
  45. np.random.SFC64(SEED_ARR_FLOAT) # E: incompatible type
  46. np.random.SFC64(SEED_ARRLIKE_FLOAT) # E: incompatible type
  47. np.random.SFC64(SEED_STR) # E: incompatible type
  48. # Generator
  49. np.random.Generator(None) # E: incompatible type
  50. np.random.Generator(12333283902830213) # E: incompatible type
  51. np.random.Generator("OxFEEDF00D") # E: incompatible type
  52. np.random.Generator([123, 234]) # E: incompatible type
  53. np.random.Generator(np.array([123, 234], dtype="u4")) # E: incompatible type