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

rander should be injected with SetRand(r io.Reader) to be reproducible with seeds #105

Open
ugol opened this issue Sep 21, 2024 · 0 comments

Comments

@ugol
Copy link

ugol commented Sep 21, 2024

I added xid to JR [1], which is a CLI random data generator.
As in google uuid [2], to be possible to use different rand algorithms rander should be refactored like this:

var rander      = rand.Reader

and

func SetRand(r io.Reader) {
	if r == nil {
		rander = rand.Reader
		return
	}
	rander = r
}

that could also be useful to generate sequences with a seed (to be reproducible), though time should be mocked too (if that it's interesting I can submit another patch)

[1] https://github.com/jrnd-io/jr
[2] https://github.com/google/uuid

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

No branches or pull requests

1 participant