---
source: crates/ruff_linter/src/rules/numpy/mod.rs
---
NPY002 Replace legacy `np.random.standard_normal` call with `np.random.Generator`
  --> NPY002.py:12:8
   |
10 | from numpy import random
11 |
12 | vals = random.standard_normal(10)
   |        ^^^^^^^^^^^^^^^^^^^^^^
13 | more_vals = random.standard_normal(10)
14 | numbers = random.integers(high, size=5)
   |

NPY002 Replace legacy `np.random.standard_normal` call with `np.random.Generator`
  --> NPY002.py:13:13
   |
12 | vals = random.standard_normal(10)
13 | more_vals = random.standard_normal(10)
   |             ^^^^^^^^^^^^^^^^^^^^^^
14 | numbers = random.integers(high, size=5)
   |

NPY002 Replace legacy `np.random.seed` call with `np.random.Generator`
  --> NPY002.py:18:1
   |
16 | import numpy
17 |
18 | numpy.random.seed()
   | ^^^^^^^^^^^^^^^^^
19 | numpy.random.get_state()
20 | numpy.random.set_state()
   |

NPY002 Replace legacy `np.random.get_state` call with `np.random.Generator`
  --> NPY002.py:19:1
   |
18 | numpy.random.seed()
19 | numpy.random.get_state()
   | ^^^^^^^^^^^^^^^^^^^^^^
20 | numpy.random.set_state()
21 | numpy.random.rand()
   |

NPY002 Replace legacy `np.random.set_state` call with `np.random.Generator`
  --> NPY002.py:20:1
   |
18 | numpy.random.seed()
19 | numpy.random.get_state()
20 | numpy.random.set_state()
   | ^^^^^^^^^^^^^^^^^^^^^^
21 | numpy.random.rand()
22 | numpy.random.ranf()
   |

NPY002 Replace legacy `np.random.rand` call with `np.random.Generator`
  --> NPY002.py:21:1
   |
19 | numpy.random.get_state()
20 | numpy.random.set_state()
21 | numpy.random.rand()
   | ^^^^^^^^^^^^^^^^^
22 | numpy.random.ranf()
23 | numpy.random.sample()
   |

NPY002 Replace legacy `np.random.ranf` call with `np.random.Generator`
  --> NPY002.py:22:1
   |
20 | numpy.random.set_state()
21 | numpy.random.rand()
22 | numpy.random.ranf()
   | ^^^^^^^^^^^^^^^^^
23 | numpy.random.sample()
24 | numpy.random.randn()
   |

NPY002 Replace legacy `np.random.sample` call with `np.random.Generator`
  --> NPY002.py:23:1
   |
21 | numpy.random.rand()
22 | numpy.random.ranf()
23 | numpy.random.sample()
   | ^^^^^^^^^^^^^^^^^^^
24 | numpy.random.randn()
25 | numpy.random.randint()
   |

NPY002 Replace legacy `np.random.randn` call with `np.random.Generator`
  --> NPY002.py:24:1
   |
22 | numpy.random.ranf()
23 | numpy.random.sample()
24 | numpy.random.randn()
   | ^^^^^^^^^^^^^^^^^^
25 | numpy.random.randint()
26 | numpy.random.random()
   |

NPY002 Replace legacy `np.random.randint` call with `np.random.Generator`
  --> NPY002.py:25:1
   |
23 | numpy.random.sample()
24 | numpy.random.randn()
25 | numpy.random.randint()
   | ^^^^^^^^^^^^^^^^^^^^
26 | numpy.random.random()
27 | numpy.random.random_integers()
   |

NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
  --> NPY002.py:26:1
   |
24 | numpy.random.randn()
25 | numpy.random.randint()
26 | numpy.random.random()
   | ^^^^^^^^^^^^^^^^^^^
27 | numpy.random.random_integers()
28 | numpy.random.random_sample()
   |

NPY002 Replace legacy `np.random.random_integers` call with `np.random.Generator`
  --> NPY002.py:27:1
   |
25 | numpy.random.randint()
26 | numpy.random.random()
27 | numpy.random.random_integers()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 | numpy.random.random_sample()
29 | numpy.random.choice()
   |

NPY002 Replace legacy `np.random.random_sample` call with `np.random.Generator`
  --> NPY002.py:28:1
   |
26 | numpy.random.random()
27 | numpy.random.random_integers()
28 | numpy.random.random_sample()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
29 | numpy.random.choice()
30 | numpy.random.bytes()
   |

NPY002 Replace legacy `np.random.choice` call with `np.random.Generator`
  --> NPY002.py:29:1
   |
27 | numpy.random.random_integers()
28 | numpy.random.random_sample()
29 | numpy.random.choice()
   | ^^^^^^^^^^^^^^^^^^^
30 | numpy.random.bytes()
31 | numpy.random.shuffle()
   |

NPY002 Replace legacy `np.random.bytes` call with `np.random.Generator`
  --> NPY002.py:30:1
   |
28 | numpy.random.random_sample()
29 | numpy.random.choice()
30 | numpy.random.bytes()
   | ^^^^^^^^^^^^^^^^^^
31 | numpy.random.shuffle()
32 | numpy.random.permutation()
   |

NPY002 Replace legacy `np.random.shuffle` call with `np.random.Generator`
  --> NPY002.py:31:1
   |
29 | numpy.random.choice()
30 | numpy.random.bytes()
31 | numpy.random.shuffle()
   | ^^^^^^^^^^^^^^^^^^^^
32 | numpy.random.permutation()
33 | numpy.random.beta()
   |

NPY002 Replace legacy `np.random.permutation` call with `np.random.Generator`
  --> NPY002.py:32:1
   |
30 | numpy.random.bytes()
31 | numpy.random.shuffle()
32 | numpy.random.permutation()
   | ^^^^^^^^^^^^^^^^^^^^^^^^
33 | numpy.random.beta()
34 | numpy.random.binomial()
   |

NPY002 Replace legacy `np.random.beta` call with `np.random.Generator`
  --> NPY002.py:33:1
   |
31 | numpy.random.shuffle()
32 | numpy.random.permutation()
33 | numpy.random.beta()
   | ^^^^^^^^^^^^^^^^^
34 | numpy.random.binomial()
35 | numpy.random.chisquare()
   |

NPY002 Replace legacy `np.random.binomial` call with `np.random.Generator`
  --> NPY002.py:34:1
   |
32 | numpy.random.permutation()
33 | numpy.random.beta()
34 | numpy.random.binomial()
   | ^^^^^^^^^^^^^^^^^^^^^
35 | numpy.random.chisquare()
36 | numpy.random.dirichlet()
   |

NPY002 Replace legacy `np.random.chisquare` call with `np.random.Generator`
  --> NPY002.py:35:1
   |
33 | numpy.random.beta()
34 | numpy.random.binomial()
35 | numpy.random.chisquare()
   | ^^^^^^^^^^^^^^^^^^^^^^
36 | numpy.random.dirichlet()
37 | numpy.random.exponential()
   |

NPY002 Replace legacy `np.random.dirichlet` call with `np.random.Generator`
  --> NPY002.py:36:1
   |
34 | numpy.random.binomial()
35 | numpy.random.chisquare()
36 | numpy.random.dirichlet()
   | ^^^^^^^^^^^^^^^^^^^^^^
37 | numpy.random.exponential()
38 | numpy.random.f()
   |

NPY002 Replace legacy `np.random.exponential` call with `np.random.Generator`
  --> NPY002.py:37:1
   |
35 | numpy.random.chisquare()
36 | numpy.random.dirichlet()
37 | numpy.random.exponential()
   | ^^^^^^^^^^^^^^^^^^^^^^^^
38 | numpy.random.f()
39 | numpy.random.gamma()
   |

NPY002 Replace legacy `np.random.f` call with `np.random.Generator`
  --> NPY002.py:38:1
   |
36 | numpy.random.dirichlet()
37 | numpy.random.exponential()
38 | numpy.random.f()
   | ^^^^^^^^^^^^^^
39 | numpy.random.gamma()
40 | numpy.random.geometric()
   |

NPY002 Replace legacy `np.random.gamma` call with `np.random.Generator`
  --> NPY002.py:39:1
   |
37 | numpy.random.exponential()
38 | numpy.random.f()
39 | numpy.random.gamma()
   | ^^^^^^^^^^^^^^^^^^
40 | numpy.random.geometric()
41 | numpy.random.gumbel()
   |

NPY002 Replace legacy `np.random.geometric` call with `np.random.Generator`
  --> NPY002.py:40:1
   |
38 | numpy.random.f()
39 | numpy.random.gamma()
40 | numpy.random.geometric()
   | ^^^^^^^^^^^^^^^^^^^^^^
41 | numpy.random.gumbel()
42 | numpy.random.hypergeometric()
   |

NPY002 Replace legacy `np.random.gumbel` call with `np.random.Generator`
  --> NPY002.py:41:1
   |
39 | numpy.random.gamma()
40 | numpy.random.geometric()
41 | numpy.random.gumbel()
   | ^^^^^^^^^^^^^^^^^^^
42 | numpy.random.hypergeometric()
43 | numpy.random.laplace()
   |

NPY002 Replace legacy `np.random.hypergeometric` call with `np.random.Generator`
  --> NPY002.py:42:1
   |
40 | numpy.random.geometric()
41 | numpy.random.gumbel()
42 | numpy.random.hypergeometric()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 | numpy.random.laplace()
44 | numpy.random.logistic()
   |

NPY002 Replace legacy `np.random.laplace` call with `np.random.Generator`
  --> NPY002.py:43:1
   |
41 | numpy.random.gumbel()
42 | numpy.random.hypergeometric()
43 | numpy.random.laplace()
   | ^^^^^^^^^^^^^^^^^^^^
44 | numpy.random.logistic()
45 | numpy.random.lognormal()
   |

NPY002 Replace legacy `np.random.logistic` call with `np.random.Generator`
  --> NPY002.py:44:1
   |
42 | numpy.random.hypergeometric()
43 | numpy.random.laplace()
44 | numpy.random.logistic()
   | ^^^^^^^^^^^^^^^^^^^^^
45 | numpy.random.lognormal()
46 | numpy.random.logseries()
   |

NPY002 Replace legacy `np.random.lognormal` call with `np.random.Generator`
  --> NPY002.py:45:1
   |
43 | numpy.random.laplace()
44 | numpy.random.logistic()
45 | numpy.random.lognormal()
   | ^^^^^^^^^^^^^^^^^^^^^^
46 | numpy.random.logseries()
47 | numpy.random.multinomial()
   |

NPY002 Replace legacy `np.random.logseries` call with `np.random.Generator`
  --> NPY002.py:46:1
   |
44 | numpy.random.logistic()
45 | numpy.random.lognormal()
46 | numpy.random.logseries()
   | ^^^^^^^^^^^^^^^^^^^^^^
47 | numpy.random.multinomial()
48 | numpy.random.multivariate_normal()
   |

NPY002 Replace legacy `np.random.multinomial` call with `np.random.Generator`
  --> NPY002.py:47:1
   |
45 | numpy.random.lognormal()
46 | numpy.random.logseries()
47 | numpy.random.multinomial()
   | ^^^^^^^^^^^^^^^^^^^^^^^^
48 | numpy.random.multivariate_normal()
49 | numpy.random.negative_binomial()
   |

NPY002 Replace legacy `np.random.multivariate_normal` call with `np.random.Generator`
  --> NPY002.py:48:1
   |
46 | numpy.random.logseries()
47 | numpy.random.multinomial()
48 | numpy.random.multivariate_normal()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49 | numpy.random.negative_binomial()
50 | numpy.random.noncentral_chisquare()
   |

NPY002 Replace legacy `np.random.negative_binomial` call with `np.random.Generator`
  --> NPY002.py:49:1
   |
47 | numpy.random.multinomial()
48 | numpy.random.multivariate_normal()
49 | numpy.random.negative_binomial()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 | numpy.random.noncentral_chisquare()
51 | numpy.random.noncentral_f()
   |

NPY002 Replace legacy `np.random.noncentral_chisquare` call with `np.random.Generator`
  --> NPY002.py:50:1
   |
48 | numpy.random.multivariate_normal()
49 | numpy.random.negative_binomial()
50 | numpy.random.noncentral_chisquare()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 | numpy.random.noncentral_f()
52 | numpy.random.normal()
   |

NPY002 Replace legacy `np.random.noncentral_f` call with `np.random.Generator`
  --> NPY002.py:51:1
   |
49 | numpy.random.negative_binomial()
50 | numpy.random.noncentral_chisquare()
51 | numpy.random.noncentral_f()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
52 | numpy.random.normal()
53 | numpy.random.pareto()
   |

NPY002 Replace legacy `np.random.normal` call with `np.random.Generator`
  --> NPY002.py:52:1
   |
50 | numpy.random.noncentral_chisquare()
51 | numpy.random.noncentral_f()
52 | numpy.random.normal()
   | ^^^^^^^^^^^^^^^^^^^
53 | numpy.random.pareto()
54 | numpy.random.poisson()
   |

NPY002 Replace legacy `np.random.pareto` call with `np.random.Generator`
  --> NPY002.py:53:1
   |
51 | numpy.random.noncentral_f()
52 | numpy.random.normal()
53 | numpy.random.pareto()
   | ^^^^^^^^^^^^^^^^^^^
54 | numpy.random.poisson()
55 | numpy.random.power()
   |

NPY002 Replace legacy `np.random.poisson` call with `np.random.Generator`
  --> NPY002.py:54:1
   |
52 | numpy.random.normal()
53 | numpy.random.pareto()
54 | numpy.random.poisson()
   | ^^^^^^^^^^^^^^^^^^^^
55 | numpy.random.power()
56 | numpy.random.rayleigh()
   |

NPY002 Replace legacy `np.random.power` call with `np.random.Generator`
  --> NPY002.py:55:1
   |
53 | numpy.random.pareto()
54 | numpy.random.poisson()
55 | numpy.random.power()
   | ^^^^^^^^^^^^^^^^^^
56 | numpy.random.rayleigh()
57 | numpy.random.standard_cauchy()
   |

NPY002 Replace legacy `np.random.rayleigh` call with `np.random.Generator`
  --> NPY002.py:56:1
   |
54 | numpy.random.poisson()
55 | numpy.random.power()
56 | numpy.random.rayleigh()
   | ^^^^^^^^^^^^^^^^^^^^^
57 | numpy.random.standard_cauchy()
58 | numpy.random.standard_exponential()
   |

NPY002 Replace legacy `np.random.standard_cauchy` call with `np.random.Generator`
  --> NPY002.py:57:1
   |
55 | numpy.random.power()
56 | numpy.random.rayleigh()
57 | numpy.random.standard_cauchy()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58 | numpy.random.standard_exponential()
59 | numpy.random.standard_gamma()
   |

NPY002 Replace legacy `np.random.standard_exponential` call with `np.random.Generator`
  --> NPY002.py:58:1
   |
56 | numpy.random.rayleigh()
57 | numpy.random.standard_cauchy()
58 | numpy.random.standard_exponential()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59 | numpy.random.standard_gamma()
60 | numpy.random.standard_normal()
   |

NPY002 Replace legacy `np.random.standard_gamma` call with `np.random.Generator`
  --> NPY002.py:59:1
   |
57 | numpy.random.standard_cauchy()
58 | numpy.random.standard_exponential()
59 | numpy.random.standard_gamma()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 | numpy.random.standard_normal()
61 | numpy.random.standard_t()
   |

NPY002 Replace legacy `np.random.standard_normal` call with `np.random.Generator`
  --> NPY002.py:60:1
   |
58 | numpy.random.standard_exponential()
59 | numpy.random.standard_gamma()
60 | numpy.random.standard_normal()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61 | numpy.random.standard_t()
62 | numpy.random.triangular()
   |

NPY002 Replace legacy `np.random.standard_t` call with `np.random.Generator`
  --> NPY002.py:61:1
   |
59 | numpy.random.standard_gamma()
60 | numpy.random.standard_normal()
61 | numpy.random.standard_t()
   | ^^^^^^^^^^^^^^^^^^^^^^^
62 | numpy.random.triangular()
63 | numpy.random.uniform()
   |

NPY002 Replace legacy `np.random.triangular` call with `np.random.Generator`
  --> NPY002.py:62:1
   |
60 | numpy.random.standard_normal()
61 | numpy.random.standard_t()
62 | numpy.random.triangular()
   | ^^^^^^^^^^^^^^^^^^^^^^^
63 | numpy.random.uniform()
64 | numpy.random.vonmises()
   |

NPY002 Replace legacy `np.random.uniform` call with `np.random.Generator`
  --> NPY002.py:63:1
   |
61 | numpy.random.standard_t()
62 | numpy.random.triangular()
63 | numpy.random.uniform()
   | ^^^^^^^^^^^^^^^^^^^^
64 | numpy.random.vonmises()
65 | numpy.random.wald()
   |

NPY002 Replace legacy `np.random.vonmises` call with `np.random.Generator`
  --> NPY002.py:64:1
   |
62 | numpy.random.triangular()
63 | numpy.random.uniform()
64 | numpy.random.vonmises()
   | ^^^^^^^^^^^^^^^^^^^^^
65 | numpy.random.wald()
66 | numpy.random.weibull()
   |

NPY002 Replace legacy `np.random.wald` call with `np.random.Generator`
  --> NPY002.py:65:1
   |
63 | numpy.random.uniform()
64 | numpy.random.vonmises()
65 | numpy.random.wald()
   | ^^^^^^^^^^^^^^^^^
66 | numpy.random.weibull()
67 | numpy.random.zipf()
   |

NPY002 Replace legacy `np.random.weibull` call with `np.random.Generator`
  --> NPY002.py:66:1
   |
64 | numpy.random.vonmises()
65 | numpy.random.wald()
66 | numpy.random.weibull()
   | ^^^^^^^^^^^^^^^^^^^^
67 | numpy.random.zipf()
   |

NPY002 Replace legacy `np.random.zipf` call with `np.random.Generator`
  --> NPY002.py:67:1
   |
65 | numpy.random.wald()
66 | numpy.random.weibull()
67 | numpy.random.zipf()
   | ^^^^^^^^^^^^^^^^^
   |
