-
Notifications
You must be signed in to change notification settings - Fork 370
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
Migrate from math/rand to math/rand/v2 #6648
Comments
I will work on this issue once the repository has migrated to Go 1.23. |
Could you please assign this issue to me? I'd love to contribute. Thank you! |
@kushal9897 #6647 has been merged, feel free to work on this |
@antoninbas Should 'Math/rand' change everywhere or just in a specific file? |
|
@antoninbas can you please describe more about this issue, please |
@kushal9897 I think the issue is self-explanatory, but I also have provided guidance in your existing PR (#6674), so I am not sure what extra information you require. If you no longer have time to work on this issue, please let me know and I can unassign you. |
i am working on it |
@antoninbas Sorry, I am unable to make changes in PR #6674. I've submitted a new PR with the required updates. Could you please review and accept the new one? Thank you! |
Hey @antoninbas I am new to open-source and I was working on this issue. Could you tell me what should I change |
@Insomniac2904 Please read https://go.dev/blog/randv2
I believe that for most uses cases, the global generator is sufficient. A local one should only be needed in certain cases, like if repeatability is needed. When you see If repeatability is needed, one can use |
It seems @ravjot07 is actively working on this |
Once #6644 is addressed and the repository has migrated to Go 1.23, we should replace all usages of the math/rand package with math/rand/v2.
math/rand/v2 provides a better API and includes various optimizations. AFAIK, there is no downside to migrating to the new version.
See https://tip.golang.org/doc/go1.22#math_rand_v2 and https://go.dev/blog/randv2 for more information.
The text was updated successfully, but these errors were encountered: