WorldRand Utility
advanced scriptingVoxel Play 3 · Scripting / API
Overview
The WorldRand class provides tools to generate consistent random values linked to specific positions or values in the game world. This enables reproducible results ideal for procedural generation. Using the same seed and inputs will always generate the same results.
Methods
Randomize
Initializes the random number table using a specific seed:
WorldRand.Randomize(seed);
GetValue
WorldRand.GetValue(Vector3 position)- Random value linked to positionWorldRand.GetValue(Vector3 position, int shift)- Random value linked to position with shiftWorldRand.GetValue(Vector3d position)- Random value linked to Vector3d positionWorldRand.GetValue(double x, double z)- Random value linked to 2D positionWorldRand.GetValue(int someValue)- Random value linked to an integerWorldRand.GetValue()- Next random value (0-1 range)
Range
Integer range:
WorldRand.Range(int min, int max, Vector3d position)- Random int in range linked to positionWorldRand.Range(int min, int max, Vector3d position, int shift)- With shiftWorldRand.Range(int min, int max)- Random int in range
Float range:
WorldRand.Range(float min, float max)- Random float in rangeWorldRand.Range(float min, float max, int seed)- Linked to seedWorldRand.Range(float min, float max, Vector3d position)- Linked to position
GetVector3
WorldRand.GetVector3(Vector3d position, float scale, float shift = 0)- Random Vector3 with uniform scaleWorldRand.GetVector3(Vector3d position, Vector3 scale, float shift = 0)- Random Vector3 with per-axis scale
Was this page helpful?
Suggest an improvement
Help us improve this documentation page.