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

Replace java.util.Random with kotlin Random object #4364

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

cbeyls
Copy link
Contributor

@cbeyls cbeyls commented Apr 8, 2024

This also improves randomness by avoiding to reinitialize the random number generator repeatedly from a seed based on the current time. Typically, if the number generator is reinitialized repeatedly at non-random times (like multiple times in a row), then generated numbers have a higher chance of repeating.

The Kotlin Random object is only initialized once, using the best seed available for the current Android version.

@connyduck connyduck merged commit ec599c8 into tuskyapp:develop Apr 10, 2024
3 checks passed
@cbeyls cbeyls deleted the refactor/random_kotlin branch April 17, 2024 12:32
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.

None yet

3 participants