Open Asterune
Random

Random

Generates pseudorandom numbers and vectors from a seed.

Behavior

Random generates pseudorandom numbers and vectors from a seed.

Summary

Constructors1
Functions1
  • Random.new(seed: number?): Random

    Creates a seeded pseudorandom generator.

Members5
Methods5

Constructors

new

Random.new(seed: number?): Random

Creates a seeded pseudorandom generator. Omit the seed to use an engine-selected seed.

Methods

Clone

Random:Clone(): Random

Returns a generator with the same current state. Subsequent identical calls produce the same results until the generators are advanced differently.

NextInteger

Random:NextInteger(min: number, max: number): number

Returns a pseudorandom integer between min and max, inclusive.

NextNumber

Random:NextNumber(range: ...number): number

Returns a pseudorandom number. With no bounds, uses the unit interval; with bounds, uses the supplied range.

NextUnitVector

Random:NextUnitVector(): Vector3

Returns a pseudorandom unit-length Vector3 direction.

Shuffle

Random:Shuffle(tb: { any }): ()

Shuffles the array entries in place using this generator.

Operators

__tostring · __type