Available since LÖVE 0.9.0
This function is not supported in earlier versions.
Sets the seed of the random number generator using the specified integer number.
RandomGenerator:setSeed( seed )
number seed
Nothing.
Due to Lua's use of double-precision floating point numbers, values above 2^53 cannot be accurately represented. Use the other variant of this function if your seed will have a larger value.
Combines two 32-bit integer numbers into a 64-bit integer value and sets the seed of the random number generator using the value.
RandomGenerator:setSeed( low, high )
number low
number high
Nothing.
Creates a new RandomGenerator object, sets the seed to the system clock's time, then generates a number between 1 and 100 inclusive. Note that the seed can be any number within the range of [0, 2^53 - 1].
function love.load() rng = love.math.newRandomGenerator() rng:setSeed(os.time()) randomNumber = rng:random(1,100) end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/RandomGenerator:setSeed