Give stages WorldRandom, a SplitMix64 generator whose every method IrisApi defines

java.util.Random fixes only some of its methods; the ranged RandomGenerator
defaults module authors reach for are left to the JDK, so an update could
change existing worlds. WorldRandom does not implement RandomGenerator and
exposes a curated set (ints, longs, ranges, booleans, floats, doubles,
gaussian, chance) with Lemire bounds and the polar gaussian on StrictMath.
StageContext, ObjectGenerationContext and BlockPalette now use it.

StageRandom becomes StageStreams; the seed derivation is unchanged. Every
method is pinned to values from an independent Python reference in
src/test/reference.
This commit is contained in:
piexel committed 2026-10-06 11:36:13 +02:00
1 parent d5aad57ad9
commit 1ce0a19abb
17 files changed
+653 -48

No files matched your search

@@ -10,7 +10,7 @@ import com.volmit.host.LoadedModules;
import com.volmit.host.PlacementRunner;
import com.volmit.host.ResolvedGraph;
import com.volmit.host.StageGraphBuilder;
import com.volmit.host.StageRandom;
import com.volmit.host.StageStreams;
import com.volmit.mantle.BlockBox;
import com.volmit.object.GeneratedObject;
import com.volmit.object.ObjectBlock;
@@ -120,7 +120,7 @@ class PlacementLifecyclePortTest {
* is the first draw of the transforms stage's own stream.
*/
private static BlockPosition placed(int x, int y, int z) {
var transforms = new Transforms(StageRandom.stream(TestContexts.SEED, PrepareModule.TRANSFORMS.id()).nextInt(4));
var transforms = new Transforms(StageStreams.stream(TestContexts.SEED, PrepareModule.TRANSFORMS.id()).nextInt(4));
var rotated = transforms.rotate(new BlockPosition(x, y, z), new BlockPosition(0, 0, 0));
return rotated.add(SURFACE_ANCHOR);
}