-
Notifications
You must be signed in to change notification settings - Fork 497
tests: replace deprecated 'golang.org/x/exp/rand' to 'math/rand/v2' #6274
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: yudrywet <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6274 +/- ##
==========================================
- Coverage 51.69% 51.68% -0.01%
==========================================
Files 646 646
Lines 86860 86860
==========================================
- Hits 44901 44893 -8
- Misses 39095 39103 +8
Partials 2864 2864 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -488,7 +488,7 @@ func TestAppRateLimiter_TxgroupToKeys(t *testing.T) { | |||
} | |||
|
|||
func BenchmarkAppRateLimiter_TxgroupToKeys(b *testing.B) { | |||
rnd := rand.New(rand.NewSource(123)) | |||
rnd := rand.New(rand.NewPCG(0, 123)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use this: rnd := rand.NewChaCha8(seed)
you won't have to change the Read()
calls, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it does seem so. I want to write a detailed demo to try it out later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used pseudo-random numbers in assumption they are a bit faster than reading crypto/rand
source.
chacha should be fine - it appears to maintain all it state in memory, no syscalls/etc.
@yudrywet mind finishing this PR? |
@yudrywet mind finishing this PR? |
@yudrywet this can be rebased and then apply the suggested chacha changes if you have bandwidth |
Summary
golang.org/x/exp/rand will be deprecated. Use math/rand/v2 in std.
For more info can see https://go.dev/issue/61716.
Test Plan