felixpatzelt / colorednoise

Python package to generate Gaussian (1/f)**beta noise (e.g. pink noise)
MIT License
195 stars 20 forks source link

Add support random_state argument #10

Closed i-aki-y closed 2 years ago

i-aki-y commented 2 years ago

In this PR, I would like to add random_state argument support.

The np.random.seed function can reset the random number generator's seed, but this is unstable against code changes. Because the np.random.seed is global and inserting a code like np.random.random() can change the random sequence after the inserted code. The random_state allows the user to easily manage the reproducibility of their code.

I appreciate it if you review this.

felixpatzelt commented 2 years ago

Hi @i-aki-y, this looks good to me but it breaks support for Python 2.7. That's OK at this point I guess, but we should create a new major version and also set specify this requirement. If you have no other suggestion I'll change the PR to go into another branch later and make the necessary changes.

i-aki-y commented 2 years ago

@felixpatzelt Thank you for your review.

this looks good to me but it breaks support for Python 2.7.

Oh, I missed that point.

That's OK at this point I guess, but we should create a new major version and also set specify this requirement. If you have no other suggestion I'll change the PR to go into another branch later and make the necessary changes.

Making a new major version makes sense to me. Of course, you can change the PR to fit your convenience and take your time.