Generator
sounds like a replacement for RandomState
, and the way of the future for generating random numbers in NumPy.
What features or behavior (currently or planned) does Generator
have that RandomState
doesn't?
Both can be parameterized with BitGenerator
objects. They have some different methods, but the vast majority appear to be the same.
Relevant links:
As of numpy version 1.23, they list 9 differences at What’s New or Different. To better understand the logic behind the change, I'd recommend reading NEP 19
TLDR:
dtype
, out
and axis
arguments to fill parts of existing arrays and to control output datatypes.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With