better-random/README.md
2025-03-11 11:08:33 +07:00

35 lines
2.2 KiB
Markdown

Better Random
=======
##### Disclaimer
This mod changes RNG, and as such, affects worldgen greatly, so with this mod alone installed vanilla world seeds will no longer
be reproducible. If you care about preserving vanilla worldgen parity in your modpack, **refrain** from installing this mod.
You were warned.
### About the mod
Better Random, or Better PRNG if you prefer, is a mod which replace Minecraft's default
[Linear congruential generator](https://en.wikipedia.org/wiki/Linear_congruential_generator)
(LCG for short, used for generating most of random game events, as well as generator used when generating world features)
and Xoshiro128PlusPlus (used to generate "sequences" aka random generator used for `LootPool`s)
with a better random number generator, [gjrand](https://gjrand.sourceforge.net).
### Features:
* Replaces `RandomSupport#create`, and subsequently, `Entity#random`, `Level#random`, worldgen (but not noise map, which means world will have same elevation, but different feature placement), countless other places including mods;
* Patches `WorldgenRandom` to convert `LegacyRandomSource` and `XoroshiroRandomSource` to random provided by Better Random, albeit patch is lazy and it may interfere with other mods which deliberately want these random generators to be underlying generators;
* Replaces `RandomSequence` and `RandomSequences` with versions which use gjrand;
* Replaces `Level#getBlockRandomPos` to use `Level#random`. Previously, `getBlockRandomPos` utilized LCG with even worse properties than one of `Level#random`.
### Caveats:
* Slime chunk function was patched to be hardwired to LegacyRandomSource so they don't change with this mod installed.
### Compatibility:
Should be compatible with everything that doesn't go around public interfaces vanilla code provide.
Existing `RandomSequence` saved data is left untouched (in meaning that nothing is done to it through code,
but Minecraft continue to load/create it upon server start), and removing Better Random mid-game won't have any
noticeable side effects (but world generation *may* look weird after installing/removing the mod, because
`RandomSupport#create` is used to determine how to place world features, such as ores and trees).