Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LS-60884] remove uses of rand.Seed #71

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

jdcrouse
Copy link
Contributor

@jdcrouse jdcrouse commented Sep 6, 2024

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 repo

What is the new behavior?

All uses of rand.Seed(someseed) are removed. This is replaced with rand.New(rand.NewSource(someseed)) which is the preferred way to handle this according to doc strings. Instead of using the global rand in random generation, the preferred method seems to be to pass down the generator created by rand.New so this also passed down generators into any method that uses them

There 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

@jdcrouse jdcrouse merged commit 91429ba into main Sep 9, 2024
3 checks passed
@jdcrouse jdcrouse deleted the jason/LS-60884/replace-rand-seed branch September 9, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants