Lore archive · Warcraft Wiki, 2023 dump
API fastrandom
Last wiki revision 2022-07-21
Returns a random number within the specified interval. rand = fastrandom([ [low, ] high])
- low: - lower integer limit on the returned random value.
- high: - upper integer limit on the returned random value.
- rand: - 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.
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.
Source
https://warcraft.wiki.gg/wiki/API_fastrandom · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.