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

implement xoroshiro128 RNG #66

Merged
merged 4 commits into from
Aug 30, 2024
Merged

implement xoroshiro128 RNG #66

merged 4 commits into from
Aug 30, 2024

Conversation

kralverde
Copy link
Contributor

A rust implementation of one of Minecraft's RNGs: XOROshiro128, including tests cases against the results of equivalent java code

@Snowiiii
Copy link
Owner

Hey i actually never heard of XOROshiro128. Can you may explain a bit?. It looks like its an random generator. I wonder where Mojang uses this implementation

@Snowiiii
Copy link
Owner

@kralverde
Copy link
Contributor Author

I never heard of it either, my code is basically 1-1 of the Minecraft Java. I saw the rust crate too, but it gives different values for the same seed as the Minecraft one

@kralverde
Copy link
Contributor Author

Actually let me double check myself

@kralverde
Copy link
Contributor Author

Yeah, I just used this as a wrapper around the rust implementation and the tests failed. It may have been user error, but this works and I think is good enough (TM)

@kralverde
Copy link
Contributor Author

We can always come back to it and change the internals, I just wanna get a stepping stone for chunk generation out of the way

@kralverde
Copy link
Contributor Author

Oh, i think I spotted an error on my side. Alright I'm hooked now, I'll see if I can get the rust crate working as a back-end implementation

@kralverde
Copy link
Contributor Author

I can confirm that the rust implementation uses different magic numbers than the java version. I refactored a bit, but I am confident that this is what we should use for the XorOshiro128 implementation

@Snowiiii
Copy link
Owner

Thank you @kralverde

@Snowiiii Snowiiii merged commit 6a45746 into Snowiiii:master Aug 30, 2024
5 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