Skip to content

Fix Grass Patterns due to Bad PRNG Seeding#86

Merged
themrdemonized merged 1 commit intothemrdemonized:all-in-one-vs2022-wpofrom
deggua:fix-grass-rng-patterns
Oct 13, 2024
Merged

Fix Grass Patterns due to Bad PRNG Seeding#86
themrdemonized merged 1 commit intothemrdemonized:all-in-one-vs2022-wpofrom
deggua:fix-grass-rng-patterns

Conversation

@deggua
Copy link
Contributor

@deggua deggua commented Oct 13, 2024

See this GAMMA Discord discussion and comparison for example:
https://discord.com/channels/912320241713958912/1279805292472832101/1295062734836338858

Basically: The seeding procedure before had too much symmetry (e.g. if D.sx = A and D.sz = B then the configuration D.sx = B and D.sz = A would produce the same seed value) and when either were 0 it would produce the same seed along the entire axis (in world coordinates).

Using a 64-bit LCG iteration as a hash function, and combining D.sx and D.sz into a u64 in this way removes symmetries and solves the 0 problem. More info on LCGs here:
https://en.wikipedia.org/wiki/Linear_congruential_generator
https://www.pcg-random.org/posts/does-it-beat-the-minimal-standard.html (this is where I got the 64-bit constant from)

@themrdemonized
Copy link
Owner

thanks

@themrdemonized themrdemonized merged commit 722d3d8 into themrdemonized:all-in-one-vs2022-wpo Oct 13, 2024
themrdemonized added a commit that referenced this pull request Oct 14, 2024
Fix Grass Patterns due to Bad PRNG Seeding

(cherry picked from commit 722d3d8)
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