lovr.math.newRandomGenerator

Edit

Creates a new RandomGenerator, which can be used to generate random numbers. If you just want some random numbers, you can use lovr.math.random. Individual RandomGenerator objects are useful if you need more control over the random sequence used or need a random generator isolated from other instances.




Create a RandomGenerator with a default seed.

Arguments

None

Returns

NameTypeDescription
randomGeneratorRandomGenerator The new RandomGenerator.

Arguments

NameTypeDescription
seednumber The initial seed for the RandomGenerator.

Returns

NameTypeDescription
randomGeneratorRandomGenerator The new RandomGenerator.

This variant allows creation of random generators with precise 64-bit seed values, since Lua's number format loses precision with really big numbers.

Arguments

NameTypeDescription
lownumber The lower 32 bits of the seed.
highnumber The upper 32 bits of the seed.

Returns

NameTypeDescription
randomGeneratorRandomGenerator The new RandomGenerator.

See also