A RandomGenerator is a standalone object that can be used to independently generate pseudo-random numbers. If you just need basic randomness, you can use lovr.math.random without needing to create a random generator.


lovr.math.newRandomGeneratorCreate a new RandomGenerator.


RandomGenerator:randomGet a random number.
RandomGenerator:randomNormalGet a random number from a normal distribution.
RandomGenerator:getSeedGet the seed value of the RandomGenerator.
RandomGenerator:setSeedReinitialize the RandomGenerator with a new seed.
RandomGenerator:getStateGet the current state of the RandomGenerator.
RandomGenerator:setStateSet the state of the RandomGenerator.

See also