RandomSource

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.util.math.RandomSource;

Methods

Return Type: boolean

script.zs
// RandomSource.nextBoolean() as boolean
myRandomSource.nextBoolean();

Return Type: double

script.zs
// RandomSource.nextDouble() as double
myRandomSource.nextDouble();

Return Type: float

script.zs
// RandomSource.nextFloat() as float
myRandomSource.nextFloat();

Return Type: double

script.zs
// RandomSource.nextGaussian() as double
myRandomSource.nextGaussian();

Return Type: int

script.zs
// RandomSource.nextInt() as int
myRandomSource.nextInt();

Return Type: int

script.zs
RandomSource.nextInt(bound as int) as int
ParameterType
Parameter
bound
Type
int

Return Type: int

script.zs
RandomSource.nextInt(bound as int, origin as int) as int
ParameterType
Parameter
bound
Type
int
Parameter
origin
Type
int

Return Type: int

script.zs
RandomSource.nextIntBetweenInclusive(origin as int, bound as int) as int
ParameterType
Parameter
origin
Type
int
Parameter
bound
Type
int

Return Type: long

script.zs
// RandomSource.nextLong() as long
myRandomSource.nextLong();