Naev

Module prng

Simple deterministic Lua PRNG.

Meant when you want worse quality random numbers and more deterministic than what the rnd module provides.

Class prng

prng:new ([seed=1]) Creates a new pseudo random number generator.
prng:setSeed (seed) Sets the seed of a PRNG object.
prng:random ([min=0[, max=1]]) Gets a random integer value between min and max.
prng:_rnd () Gets a value between 0 and 1.


Class prng

A pseudo random number generator class.
prng:new ([seed=1])
Creates a new pseudo random number generator.

Parameters:

  • seed string or number Seed to initialize with. (default 1)

Returns:

    prng A new PRNG object.
prng:setSeed (seed)
Sets the seed of a PRNG object.

Parameters:

  • seed string or number Seed to set.
prng:random ([min=0[, max=1]])
Gets a random integer value between min and max.

If max is ommitted, a value between [1,max] is returned.

If both min and max are nil, a floating point value between [0,1] is returned.

Parameters:

  • min number Minimum value to get from. (default 0)
  • max number Maximum value to get from. (default 1)

Returns:

    number Random number value.
prng:_rnd ()
Gets a value between 0 and 1.

Returns:

    number Random number value.
generated by LDoc 1.4.6 Last updated 2021-07-27 21:51:06