lovr.math.random
EditReturns a uniformly distributed pseudo-random number. This function has improved randomness over Lua's math.random
and also guarantees that the sequence of random numbers will be the same on all platforms (given the same seed).
Generate a pseudo-random floating point number in the range [0,1)
Arguments
None
Returns
Name | Type | Description |
x | number | A pseudo-random number. |
Generate a pseudo-random integer in the range [1,high]
Arguments
Name | Type | Description |
high | number | The maximum number to generate. |
Returns
Name | Type | Description |
x | number | A pseudo-random number. |
Generate a pseudo-random integer in the range [low,high]
Arguments
Name | Type | Description |
low | number | The minimum number to generate. |
high | number | The maximum number to generate. |
Returns
Name | Type | Description |
x | number | A pseudo-random number. |
Notes
You can set the random seed using lovr.math.setRandomSeed
.