Random
Link to random
导入类
Link to 导入类
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.
ZenScript Copyimport crafttweaker.api.util.Random;
使用方式
Link to 使用方式
Name: getRandomUUID
Return Type: string
ZenScript Copy// Random.getRandomUUID() as string
myRandom.getRandomUUID();
Name: nextBoolean
Return Type: boolean
ZenScript Copy// Random.nextBoolean() as boolean
myRandom.nextBoolean();
Name: nextDouble
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
Return Type: double
ZenScript Copy// Random.nextDouble() as double
myRandom.nextDouble();
Name: nextDouble
Returns the next pseudorandom double. Its range is [min, max]
Return Type: double
ZenScript CopyRandom.nextDouble(min as double, max as double) as double
参数 | 类型 | 描述 |
---|---|---|
参数 min | 类型 double | 描述 No Description Provided |
参数 max | 类型 double | 描述 No Description Provided |
Name: nextFloat
Returns the next pseudorandom, uniformly distributed float value between 0.0f and 1.0f from this random number generator's sequence.
Return Type: float
ZenScript Copy// Random.nextFloat() as float
myRandom.nextFloat();
Name: nextFloat
Returns the next pseudorandom float. Its range is [min, max]
Return Type: float
ZenScript CopyRandom.nextFloat(min as float, max as float) as float
参数 | 类型 | 描述 |
---|---|---|
参数 min | 类型 float | 描述 No Description Provided |
参数 max | 类型 float | 描述 No Description Provided |
Name: nextInt
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
Return Type: int
ZenScript Copy// Random.nextInt() as int
myRandom.nextInt();
Name: nextInt
Returns the next pseudorandom, uniformly distributed int value between zero (inclusive) and bound (exclusive) from this random number generator's sequence
Return Type: int
ZenScript CopyRandom.nextInt(bound as int) as int
参数 | 类型 | 描述 |
---|---|---|
参数 bound | 类型 int | 描述 the upper bound (exclusive). Must be positive. |
Name: nextInt
Returns the next pseudorandom int. Its range is [min, max]
Return Type: int
ZenScript CopyRandom.nextInt(min as int, max as int) as int
参数 | 类型 | 描述 |
---|---|---|
参数 min | 类型 int | 描述 No Description Provided |
参数 max | 类型 int | 描述 No Description Provided |