API fastrandom

Returns a random number within the specified interval. rand = fastrandom([ [low, ] high])

Arguments

 * low : Number - lower integer limit on the returned random value.
 * high : Number - upper integer limit on the returned random value.

Returns

 * rand : Number - Generated random value. If no arguments were specified, the value is a uniformly-distributed decimal between 0 (inclusive) and 1 (exclusive). Otherwise, returns a uniformly-distributed integer between  (1 if not specified) and , both bounds inclusive.

Details
local state = 0 -- initialized by seeding function random(high) state = (state * 214013 + 2531011) % 2^32; local rand = math.floor(state / 2^16) % 2^15; return 1 + math.floor(rand / 0x7fff * high) end
 * This function uses C's  function as a random number generator. On the Windows client, the implementation of   is equivalent to the following, which is not cryptographically secure: it is possible to derive its internal state from a few samples of its output and correctly predict the results of subsequent calls.
 * Lua's  is not available in World of Warcraft; the random number generator is instead seeded by the client at startup.