uniform

fun ShapeProvider.uniform(pointCount: Int, random: Random = Random.Default): List<Vector2>(source)

Generates a list of uniformly distributed points within the shape provided by the ShapeProvider.

Return

A list of Vector2 objects representing the uniformly distributed points.

Parameters

pointCount

The number of points to generate.

random

An optional random number generator to influence the distribution.


fun Int.Companion.uniform(min: Int = -1, max: Int = 2, random: Random = Random.Default): Int(source)

Generates a uniformly distributed random integer within the specified range.

Return

A random integer value within the range [min, max).

Parameters

min

The lower bound of the range (inclusive). Default is -1.

max

The upper bound of the range (exclusive). Default is 2.

random

An instance of Random to generate the random value. Default is Random.Default.


fun Double.Companion.uniform(min: Double = -1.0, max: Double = 1.0, random: Random = Random.Default): Double(source)

Generates a random double value within the specified range min, max.

Return

A randomly generated double value between min, max.

Parameters

min

The minimum value of the range (inclusive). Defaults to -1.0.

max

The maximum value of the range (exclusive). Defaults to 1.0.

random

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


fun Vector2.Companion.uniform(min: Vector2 = -ONE, max: Vector2 = ONE, random: Random = Random.Default): Vector2(source)

Generates a random 2D vector with each component uniformly distributed within the specified ranges.

Return

A randomly generated Vector2 object with components within [min.x, max.x) and [min.y, max.y).

Parameters

min

The minimum values for the x and y components of the vector (inclusive). Defaults to Vector2(-1, -1).

max

The maximum values for the x and y components of the vector (exclusive). Defaults to Vector2(1, 1).

random

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


fun Vector2.Companion.uniform(min: Double = -1.0, max: Double = 1.0, random: Random = Random.Default): Vector2(source)

Generates a random 2D vector with components uniformly distributed within the specified range.

Return

A randomly generated Vector2 object with both x and y components within the range [min, max).

Parameters

min

The minimum value for both x and y components of the vector (inclusive). Default is -1.0.

max

The maximum value for both x and y components of the vector (exclusive). Default is 1.0.

random

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


fun Vector2.Companion.uniform(rect: Rectangle, random: Random = Random.Default): Vector2(source)

Generates a random 2D vector uniformly distributed within the specified rectangular bounds.

Return

A randomly generated Vector2 object with components within the bounds of the specified rectangle.

Parameters

rect

The rectangle within which the vector's components will be randomly generated.

random

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


fun IntVector2.Companion.uniform(min: IntVector2 = IntVector2(-1, -1), max: IntVector2 = IntVector2(2, 2), random: Random = Random.Default): IntVector2(source)

Generates a random IntVector2 with each component within the specified ranges.

Parameters

min

The minimum values for the x and y components of the vector. Default is IntVector2(-1, -1).

max

The maximum exclusive values for the x and y components of the vector. Default is IntVector2(2, 2).

random

The random number generator used to generate the values. Default is Random.Default.


fun IntVector2.Companion.uniform(min: Int = -1, max: Int = 2, random: Random = Random.Default): IntVector2(source)

Generates a uniform random IntVector2 within the specified range.

Return

A randomly generated IntVector2 within the specified bounds.

Parameters

min

The minimum inclusive value for both components of the vector. Defaults to -1.

max

The maximum exclusive value for both components of the vector. Defaults to 2.

random

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


fun Vector3.Companion.uniform(min: Double = -1.0, max: Double = 1.0, random: Random = Random.Default): Vector3(source)

Generates a random vector with each component uniformly distributed between the specified minimum and maximum bounds.

Return

A random vector with each component uniformly distributed between the specified bounds.

Parameters

min

The minimum bound for the vector components. Defaults to -1.0 for all components.

max

The maximum bound for the vector components. Defaults to 1.0 for all components.

random

The source of randomness. Defaults to the system default random generator.


fun Vector3.Companion.uniform(min: Vector3 = -ONE, max: Vector3 = ONE, random: Random = Random.Default): Vector3(source)

Generates a random vector with components uniformly distributed between the specified minimum and maximum bounds.

Return

A random vector with components uniformly distributed between the specified bounds.

Parameters

min

The minimum bound for each component of the vector. Defaults to a vector with all components set to -1.

max

The maximum bound for each component of the vector. Defaults to a vector with all components set to 1.

random

The source of randomness. Defaults to the system default random generator.


fun Vector4.Companion.uniform(min: Double = -1.0, max: Double = 1.0, random: Random = Random.Default): Vector4(source)

Generates a random 4-dimensional vector with each component sampled uniformly from a specified range between min and max.

Return

A Vector4 instance with random components within the specified range.

Parameters

min

The minimum value of the range for all components. Default is -1.0.

max

The maximum value of the range for all components. Default is 1.0.

random

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


fun Vector4.Companion.uniform(min: Vector4 = -ONE, max: Vector4 = ONE, random: Random = Random.Default): Vector4(source)

Generates a random 4-dimensional vector where each component is uniformly distributed within the provided range.

Return

A 4-dimensional vector with components uniformly distributed between the specified minimum and maximum values.

Parameters

min

The minimum values for each component of the vector. Defaults to -ONE.

max

The maximum values for each component of the vector. Defaults to ONE.

random

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