WorldRand Utility

advanced scripting

Voxel 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 position
  • WorldRand.GetValue(Vector3 position, int shift) - Random value linked to position with shift
  • WorldRand.GetValue(Vector3d position) - Random value linked to Vector3d position
  • WorldRand.GetValue(double x, double z) - Random value linked to 2D position
  • WorldRand.GetValue(int someValue) - Random value linked to an integer
  • WorldRand.GetValue() - Next random value (0-1 range)

Range

Integer range:

  • WorldRand.Range(int min, int max, Vector3d position) - Random int in range linked to position
  • WorldRand.Range(int min, int max, Vector3d position, int shift) - With shift
  • WorldRand.Range(int min, int max) - Random int in range

Float range:

  • WorldRand.Range(float min, float max) - Random float in range
  • WorldRand.Range(float min, float max, int seed) - Linked to seed
  • WorldRand.Range(float min, float max, Vector3d position) - Linked to position

GetVector3

  • WorldRand.GetVector3(Vector3d position, float scale, float shift = 0) - Random Vector3 with uniform scale
  • WorldRand.GetVector3(Vector3d position, Vector3 scale, float shift = 0) - Random Vector3 with per-axis scale
Was this page helpful?