Skip to content

test: use math/rand/v2 #42

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

Merged
merged 1 commit into from
Jan 1, 2025
Merged

test: use math/rand/v2 #42

merged 1 commit into from
Jan 1, 2025

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Jan 1, 2025

We upgraded our minimum Go version in PR #39, which allows us to use the math/rand/v2 package, a more 'correct' implementation compared to math/rand.

One of your papers was mentioned in the blog post: https://go.dev/blog/randv2 😉

In 2018, Daniel Lemire found an algorithm that avoids the divisions nearly all the time (see also his 2019 blog post). In math/rand, adopting Lemire’s algorithm would make Intn(1000) 20-30% faster, but we can’t: the faster algorithm generates different values than the standard conversion, breaking repeatability.

We upgraded our minimum Go version in PR
#39, so we can use the
`math/rand/v2` package too.

Reference: https://go.dev/blog/randv2
Signed-off-by: Eng Zer Jun <[email protected]>
@lemire
Copy link
Member

lemire commented Jan 1, 2025

Nice. Thanks.

@lemire lemire merged commit 51abaa4 into FastFilter:master Jan 1, 2025
4 checks passed
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