Closed MatrixManAtYrService closed 3 years ago
This is a great feature suggestion. I can work on this and provide an update.
When this was initially released, python 3.5 did not contain the random.choices method that accepted weights and returned k-length list so I added a preview method from the unreleased 3.6 to emulate that function. Now that the random.choices is generally available, I updated to use the builtin method. This took care of losing the random seed issue you were having above. The script you provided now prints the same hash for both left and right. I just committed this to git and will update the python module on pypi soon,
That's fantastic, thank you!
Hi, I'd like to use your (excellent) library to generate test datasets in a deterministic way.
I'm puzzled by my findings: It appears to be deterministic for short strings, but after a certain length, the random seed gets lost. I wrote a small script to show you what I mean:
Here is the output:
So I guess this is a feature request: Can you add a way to supply a randomness seed so that it can be made to produce the same pseudorandom output every time?
If you don't feel like it, can you give me a hint about where the seed is being forgotten? Then I'll take a crack at it in a fork.
Thank you.