Skip to main content

Namespace: random

index.random

Functions#

pick#

pick<T>(arr): T

Picks a random element from the specified array. Returns undefined if the array is empty.

Type parameters#

Name
T

Parameters#

NameType
arrT[]

Returns#

T

Defined in#

systems/random.ts:14


randomInsideCircle#

randomInsideCircle(circle): Vector

Parameters#

NameType
circleCircle

Returns#

Vector

Defined in#

systems/random.ts:43


randomInsideRect#

randomInsideRect(rect): Vector

Returns a random point inside the given rect.

Parameters#

NameType
rectRect

Returns#

Vector

Defined in#

systems/random.ts:36


randomRange#

randomRange(min?, max?): number

Returns a random value from min to max.

Parameters#

NameTypeDefault value
minnumber0
maxnumber1

Returns#

number

Defined in#

systems/random.ts:7


randomUnitVector#

randomUnitVector(): Vector

Returns a random unit vector.

Returns#

Vector

Defined in#

systems/random.ts:23