Difference between revisions of "love.math.setRandomSeed"

m (moved love.math.randomseed to love.math.setRandomState: Function has been renamed and changed)
(function was renamed and changed)
Line 1: Line 1:
 
{{newin|[[0.9.0]]|090|type=function}}
 
{{newin|[[0.9.0]]|090|type=function}}
Seeds the random number generator with a specified number.
+
Sets the state ("seed") of the random number generator using the specified integer number.
 
== Function ==
 
== Function ==
 +
Sets the state of the random number generator using the specified integer number. Due to Lua's use of double-precision floating point numbers, integer values above 2^53 cannot be accurately represented.
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.math.randomseed( seed )
+
love.math.setRandomState( state )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|seed|The number with which you want to seed the randomization.}}
+
{{param|number|state|The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].}}
 +
=== Returns ===
 +
Nothing.
 +
== Function ==
 +
Combines two 32-bit integer numbers into a 64-bit integer value and sets the state of the random number generator using the value.
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.math.setRandomState( low, high )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|low|The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].}}
 +
{{param|number|high|The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 
== See Also ==
 
== See Also ==
 
* [[parent::love.math]]
 
* [[parent::love.math]]
 +
* [[love.math.getRandomState]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Seeds the random number generator.}}
+
{{#set:Description=Sets the state of the random number generator.}}
 
== Other Languages ==
 
== Other Languages ==
{{i18n|love.math.randomseed}}
+
{{i18n|love.math.setRandomState}}

Revision as of 04:51, 11 August 2013

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

Sets the state ("seed") of the random number generator using the specified integer number.

Function

Sets the state of the random number generator using the specified integer number. Due to Lua's use of double-precision floating point numbers, integer values above 2^53 cannot be accurately represented.

Synopsis

love.math.setRandomState( state )

Arguments

number state
The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].

Returns

Nothing.

Function

Combines two 32-bit integer numbers into a 64-bit integer value and sets the state of the random number generator using the value.

Synopsis

love.math.setRandomState( low, high )

Arguments

number low
The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].
number high
The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].

Returns

Nothing.

See Also

Other Languages