Random

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

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

Implements

Undocumented Interfaces

RandomGenerator

Members

nextBoolean() as bool
script.zs
// Random.nextBoolean() as bool;
myRandom.nextBoolean();

Return Type: bool

nextDouble() as double
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
script.zs
// Random.nextDouble() as double;
myRandom.nextDouble();

Return Type: double

nextFloat() as float
Returns the next pseudorandom, uniformly distributed float value between 0.0f and 1.0f from this random number generator's sequence.
script.zs
// Random.nextFloat() as float;
myRandom.nextFloat();

Return Type: float

nextInt() as int
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
script.zs
// Random.nextInt() as int;
myRandom.nextInt();

Return Type: int

nextInt(bound as int) as int
Returns the next pseudorandom, uniformly distributed int value between zero (inclusive) and bound (exclusive) from this random number generator's sequence
script.zs
// Random.nextInt(bound as int) as int;
myRandom.nextInt(myInt);

Parameters:

bound Type: int - the upper bound (exclusive). Must be positive.

Return Type: int