Skip to content

Stochastic and Math Utilities

Rifa edited this page Aug 9, 2026 · 1 revision

Stochastic & Math Utilities

Utility Class Purpose
net.dasik.social.util.FastRandom Singleton zero-allocation RandomSource backed by ThreadLocalRandom
net.dasik.social.util.StochasticUtil Permille, decile, and percentage probability rolls
net.dasik.social.util.TimeUtil Day count calculations (gameTime / 24000L) and cycle distance math

๐ŸŽฒ FastRandom (RandomSource)

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

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

โฑ๏ธ TimeUtil Cycle Math

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

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

๐Ÿ”— Related Pages

Clone this wiki locally