LuaRandomGenerator

A deterministic random generator independent from the core games random generator that can be seeded and re-seeded at will. This random generator can be saved and loaded and will maintain its state. Note this is entirely different from calling math.random() and you should be sure you actually want to use this over calling math.random(). If you aren't sure if you need to use this over calling math.random() then you probably don't need to use this.

Example
Create a generator and use it to print a random number.
global.generator = game.create_random_generator()
game.player.print(global.generator())
class LuaRandomGenerator - sort
operator ()(lower, upper) → double Generates a random number.
re_seed(seed) Re-seeds the random generator with the given value.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
operator ()(lower, upper) → double

Generates a random number. If no parameters are given a number in the [0, 1) range is returned. If a single parameter is given a floored number in the [1, N] range is returned. If 2 parameters are given a floored number in the [N1, N2] range is returned.

Parameters
lower :: int (optional): Inclusive lower bound on the result
upper :: int (optional): Inclusive upper bound on the result
re_seed(seed)

Re-seeds the random generator with the given value.

Parameters
seed :: uint
Note: Seeds that are close together will produce similar results. Seeds from 0 to 341 will produce the same results.