[LS-60884] remove uses of rand.Seed #71
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the current behavior?
rand.Seed
is deprecated, and this deprecated method being in use is preventing the linter from allowing changes to this repoWhat is the new behavior?
All uses of
rand.Seed(someseed)
are removed. This is replaced withrand.New(rand.NewSource(someseed))
which is the preferred way to handle this according to doc strings. Instead of using the globalrand
in random generation, the preferred method seems to be to pass down the generator created byrand.New
so this also passed down generators into any method that uses themThere is a question here of where we should pass generators as function args and where we should just put the generator as a field in the structs, but a bunch of these structs have json annotations that suggest they are read from files and i do not really know how to make sure
rand
gets populated in the case where some of these structs are constructed from json