• How predictable is math.random?
    5 replies, posted
Glua's random is just pseudo random.. So how much predictable is it?
Pretty predictable, but it should do unless you are having a lottery. In that case you could query random.org.
[QUOTE=DarKSunrise;23005385]Pretty predictable, but it should do unless you are having a lottery. In that case you could query random.org.[/QUOTE] Salvaging old posts ehh? :D [URL]http://www.facepunch.com/showthread.php?t=958692[/URL]
[code]Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio > function test() >> math.randomseed(5) >> print(math.random(),math.random(),math.random()) >> end > for i = 1, 5 do test() end 0.0016479995117038 0.87566759239479 0.37400433362835 0.0016479995117038 0.87566759239479 0.37400433362835 0.0016479995117038 0.87566759239479 0.37400433362835 0.0016479995117038 0.87566759239479 0.37400433362835 0.0016479995117038 0.87566759239479 0.37400433362835 >[/code] [editline]12:15PM[/editline] If you know what the seed is, completely predictable.
You could even make a graph of the results to find out when to get the desired value.
[QUOTE=DarKSunrise;23027723]You could even make a graph of the results to find out when to get the desired value.[/QUOTE] If you know what value you want, why use math.random?
Sorry, you need to Log In to post a reply to this thread.