Difference between revisions of "love.math.newRandomGenerator"

(Created page with "{{newin|0.9.0|090|type=function}} Creates a new RandomGenerator that is completely independent of other RandomGenerator objects or other random functions. == Functio...")
 
(Updated for state/seed changes)
Line 11: Line 11:
 
=== Returns ===
 
=== Returns ===
 
{{param|RandomGenerator|rng|A Random Number Generator object.}}
 
{{param|RandomGenerator|rng|A Random Number Generator object.}}
 +
 
== Function ==
 
== Function ==
 +
See [[RandomGenerator:setState]].
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
rng = love.graphics.newRandomGenerator( seed )
+
rng = love.graphics.newRandomGenerator( state )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|seed|The seed to use for this instance of the object.}}
+
{{param|number|state|The state ("seed") number to use for this instance of the object.}}
 +
=== Returns ===
 +
{{param|RandomGenerator|rng|A Random Number Generator object.}}
 +
 
 +
== Function ==
 +
See [[RandomGenerator:setState]].
 +
=== Synopsis ===
 +
<source lang="lua">
 +
rng = love.graphics.newRandomGenerator( low, high )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|low|The lower 32 bits of the state number to use for this instance of the object.}}
 +
{{param|number|high|The higher 32 bits of the state number to use for this instance of the object.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|RandomGenerator|rng|A Random Number Generator object.}}
 
{{param|RandomGenerator|rng|A Random Number Generator object.}}

Revision as of 00:48, 12 August 2013

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Creates a new RandomGenerator that is completely independent of other RandomGenerator objects or other random functions.

Function

Synopsis

rng = love.graphics.newRandomGenerator( )

Arguments

None

Returns

RandomGenerator rng
A Random Number Generator object.

Function

See RandomGenerator:setState.

Synopsis

rng = love.graphics.newRandomGenerator( state )

Arguments

number state
The state ("seed") number to use for this instance of the object.

Returns

RandomGenerator rng
A Random Number Generator object.

Function

See RandomGenerator:setState.

Synopsis

rng = love.graphics.newRandomGenerator( low, high )

Arguments

number low
The lower 32 bits of the state number to use for this instance of the object.
number high
The higher 32 bits of the state number to use for this instance of the object.

Returns

RandomGenerator rng
A Random Number Generator object.

See Also

Other Languages