Package com.idark.valoria.util
Class RandomUtil
java.lang.Object
com.idark.valoria.util.RandomUtil
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static net.minecraft.core.BlockPos
getRandomPositionWithinRange
(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius) static net.minecraft.core.BlockPos
getRandomPositionWithinRange
(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius, boolean safeSurfacePlacement, net.minecraft.world.level.Level world) static net.minecraft.core.BlockPos
getRandomPositionWithinRange
(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius, boolean safeSurfacePlacement, net.minecraft.world.level.Level world, Predicate<net.minecraft.world.level.block.state.BlockState> statePredicate, int tries) static <T> T
getRandomSelection
(List<T> options) static <T> T
getRandomSelection
(T... options) static boolean
percentChance
(float percentChance) static double
static int
randomNumberBetween
(int min, int max) static int
randomNumberUpTo
(int upperBound) static double
randomScaledGaussianValue
(double scale) static double
randomValueBetween
(double min, double max) static double
randomValueUpTo
(double upperBound) static float
randomValueUpTo
(float upperBound)
-
Field Details
-
rand
-
-
Constructor Details
-
RandomUtil
public RandomUtil()
-
-
Method Details
-
fiftyFifty
public static boolean fiftyFifty() -
percentChance
public static boolean percentChance(float percentChance) - Parameters:
percentChance
- from 0.00f to 1
-
randomNumberUpTo
public static int randomNumberUpTo(int upperBound) -
randomValueUpTo
public static float randomValueUpTo(float upperBound) -
randomValueUpTo
public static double randomValueUpTo(double upperBound) -
randomGaussianValue
public static double randomGaussianValue() -
randomScaledGaussianValue
public static double randomScaledGaussianValue(double scale) -
randomNumberBetween
public static int randomNumberBetween(int min, int max) -
randomValueBetween
public static double randomValueBetween(double min, double max) -
getRandomSelection
public static <T> T getRandomSelection(@Nonnull T... options) -
getRandomSelection
-
getRandomPositionWithinRange
public static net.minecraft.core.BlockPos getRandomPositionWithinRange(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius) -
getRandomPositionWithinRange
public static net.minecraft.core.BlockPos getRandomPositionWithinRange(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius, boolean safeSurfacePlacement, net.minecraft.world.level.Level world) -
getRandomPositionWithinRange
public static net.minecraft.core.BlockPos getRandomPositionWithinRange(net.minecraft.core.BlockPos centerPos, int xRadius, int yRadius, int zRadius, boolean safeSurfacePlacement, net.minecraft.world.level.Level world, @Nullable Predicate<net.minecraft.world.level.block.state.BlockState> statePredicate, int tries)
-