love.math.newRandomGenerator
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions.
Contents
Function
Synopsis
rng = love.math.newRandomGenerator( )
Notes
The default seed used in version 11.x is the following low/high pair: 0xCBBF7A44, 0x0139408D.
Arguments
None
Returns
RandomGenerator rng
- The new Random Number Generator object.
Function
Synopsis
rng = love.math.newRandomGenerator( seed )
Arguments
number seed
- The initial seed number to use for this object.
Returns
RandomGenerator rng
- The new Random Number Generator object.
Notes
Function
Synopsis
rng = love.math.newRandomGenerator( low, high )
Arguments
number low
- The lower 32 bits of the seed number to use for this object.
number high
- The higher 32 bits of the seed number to use for this object.
Returns
RandomGenerator rng
- The new Random Number Generator object.
Notes
Examples
Creates a new RandomGenerator object, then generates a number between 1 and 100 inclusive.
function love.load()
rng = love.math.newRandomGenerator()
randomNumber = rng:random(1,100)
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info