uniformRing

fun Vector2.Companion.uniformRing(innerRadius: Double = 0.0, outerRadius: Double = 1.0, random: Random = Random.Default): Vector2(source)

Generates a random 2D vector uniformly distributed within a ring defined by the inner and outer radii.

Return

A 2D vector uniformly distributed within the specified ring.

Parameters

innerRadius

The inner radius of the ring. Must be less than or equal to outerRadius. Default is 0.0.

outerRadius

The outer radius of the ring. Default is 1.0.

random

The random number generator to use. Default is Random.Default.

Throws

If innerRadius is greater than outerRadius.


fun Vector3.Companion.uniformRing(innerRadius: Double = 0.0, outerRadius: Double = 1.0, random: Random = Random.Default): Vector3(source)

Generates a random 3D vector within a uniform ring defined by the provided inner and outer radii. The ring resides in a 3D space, and vectors are uniformly distributed within the specified range.

Return

A random 3D vector within the specified uniform ring.

Parameters

innerRadius

The inner radius of the ring. Default is 0.0.

outerRadius

The outer radius of the ring. Default is 1.0.

random

The random number generator to be used for generating the vector. Default is Random.Default.


fun Vector4.Companion.uniformRing(innerRadius: Double = 0.0, outerRadius: Double = 1.0, random: Random = Random.Default): Vector4(source)

Generates a uniformly distributed random 4D vector within a ring-shaped area defined by an inner and outer radius.

Return

A random 4D vector within the specified ring.

Parameters

innerRadius

The minimum radius of the ring. Defaults to 0.0.

outerRadius

The maximum radius of the ring. Defaults to 1.0.

random

An instance of Random used to generate the random vector. Defaults to Random.Default.