Skip to content

Stochastic & Math Utilities

Utility ClassPurpose
net.dasik.social.util.FastRandomSingleton zero-allocation RandomSource backed by ThreadLocalRandom
net.dasik.social.util.StochasticUtilPermille, decile, and percentage probability rolls
net.dasik.social.util.TimeUtilDay count calculations (gameTime / 24000L) and cycle distance math

🎲 FastRandom (RandomSource)

FastRandom provides a thread-safe singleton RandomSource (FastRandom.INSTANCE) delegating to ThreadLocalRandom:

java
FastRandom random = FastRandom.INSTANCE;
float val = random.nextFloat(); // [0.0f, 1.0f)

⏱️ TimeUtil Cycle Math

$$1\text{ Minecraft Day} = 24,000\text{ ticks}$$

java
long currentDay = TimeUtil.getGameDay(level.getGameTime());
long ticksToTarget = TimeUtil.getCycleDistance(currentTime, targetTime, 24000L);

Official documentation & web portal for Dasik Igaijinn mods.