Class Random

Generates pseudo random numbers using the Xorshift128 algorithm. Suitable for high performance requirements.

Hierarchy

  • FrameworkObject
    • Random

Constructors

  • Initializes a new generator using the specified seed.

    Parameters

    • Optionalseed: number
    • OptionalisInternalConstructor: boolean

    Returns Random

Methods

  • Returns a random value in range [0, NumericLimits<uint32_t>::max()].

    Returns number

  • Returns a random set of Barycentric coordinates that may be used for generating random points on a triangle.

    Returns Vector3

  • Returns a random point on a unit arc with the specified length (angle). Angle of 360 represents a circle.

    Parameters

    Returns Vector2

  • Returns a random point inside the specified range in an arc shell of unit radius, with the specified length (angle) and thickness in range [0, 1]. Angle of 360 represents a circle shell. Thickness of 0 will generate points on the arc edge, while thickness of 1 will generate points on the entire arc 'slice'. Intermediate values represent the shell, which is the surface between two concentric circles.

    Parameters

    Returns Vector2

  • Returns a random point inside a unit circle.

    Returns Vector2

  • Returns a random point inside the specified range in a circle shell of unit radius, with the specified thickness, in range [0, 1]. Thickness of 0 will generate points on the circle edge, while thickness of 1 will generate points within the entire circle surface. Intermediate values represent the shell, which is the surface between two concentric circles.

    Parameters

    • thickness: number

    Returns Vector2

  • Returns a random point inside a unit sphere.

    Returns Vector3

  • Returns a random point inside the specified range in a sphere shell of unit radius, with the specified thickness, in range [0, 1]. Thickness of 0 will generate points on the sphere surface, while thickness of 1 will generate points within the entire sphere volume. Intermediate values represent the shell, which is a volume between two concentric spheres.

    Parameters

    • thickness: number

    Returns Vector3

  • Returns a random value in range [min, max].

    Parameters

    • min: number
    • max: number

    Returns number

  • Returns a random value in range [-1, 1].

    Returns number

  • Returns a random unit vector in three dimensions.

    Returns Vector3

  • Returns a random unit vector in two dimensions.

    Returns Vector2

  • Returns a random value in range [0, 1].

    Returns number

  • Changes the seed of the generator to the specified value.

    Parameters

    • seed: number

    Returns void