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

math/rand call refactoring #567

Merged
merged 3 commits into from
Dec 16, 2024
Merged

math/rand call refactoring #567

merged 3 commits into from
Dec 16, 2024

Conversation

ErikPelli
Copy link
Collaborator

Starting from Go 1.20, math/rand is automatically seeded at startup, and we don't have to manually call rand.Seed inside init().
Replace rand.Int63() with rand.Uint64() to have an easy future transition to math/rand/v2, since Int64 function has been removed in this library.
Uint64() >> 1 is the equivalent function to always have the 0 value as the first bit, thus having a positive serial.

@ErikPelli ErikPelli changed the title Rand refactor math/rand call refactoring Dec 16, 2024
@ErikPelli ErikPelli merged commit 5d8f603 into master Dec 16, 2024
1 check passed
@ErikPelli ErikPelli deleted the rand-refactor branch December 16, 2024 21:06
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.

1 participant