Difference between revisions of "RandomGenerator:random"

m
m
Line 14: Line 14:
  
 
== Function ==
 
== Function ==
Get uniformly distributed pseudo-random integer number within [1, max]
+
Get uniformly distributed pseudo-random integer number within [1, max].
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">

Revision as of 07:49, 2 November 2015

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

Generates a pseudo-random number in a platform independent manner.

Function

Get uniformly distributed pseudo-random number within [0, 1].

Synopsis

number = RandomGenerator:random( )

Arguments

None.

Returns

number number
The pseudo-random number.

Function

Get uniformly distributed pseudo-random integer number within [1, max].

Synopsis

number = RandomGenerator:random( max )

Arguments

number max
The maximum possible value it should return.

Returns

number number
The pseudo-random integer number.

Function

Get uniformly distributed pseudo-random integer number within [min, max].

Synopsis

number = RandomGenerator:random( min, max )

Arguments

number min
The minimum possible value it should return.
number max
The maximum possible value it should return.

Returns

number number
The pseudo-random integer number.

See Also

Other Languages