lovr.math.newRandomGenerator
EditCreates a new RandomGenerator, which can be used to generate random numbers. If you just want some random numbers, you can use lovr.math.random. Individual RandomGenerator objects are useful if you need more control over the random sequence used or need a random generator isolated from other instances.
Create a RandomGenerator with a default seed.
Arguments
None
Returns
| Name | Type | Description |
| randomGenerator | RandomGenerator | The new RandomGenerator. |
Arguments
| Name | Type | Description |
| seed | number | The initial seed for the RandomGenerator. |
Returns
| Name | Type | Description |
| randomGenerator | RandomGenerator | The new RandomGenerator. |
This variant allows creation of random generators with precise 64-bit seed values, since Lua's number format loses precision with really big numbers.
Arguments
| Name | Type | Description |
| low | number | The lower 32 bits of the seed. |
| high | number | The upper 32 bits of the seed. |
Returns
| Name | Type | Description |
| randomGenerator | RandomGenerator | The new RandomGenerator. |