Difference between revisions of "Talk:GetRandomPercent"
Jump to navigation
Jump to search
cleaned up page
imported>Haama (Algorithm) |
imported>DragoonWraith (cleaned up page) |
||
Line 1: | Line 1: | ||
== Morrowind's Random100 == | |||
Is this similar to ''Morrowind's'' Random100 function, or can it be used in the same manner? [[User:TheImperialDragon|The Imperial Dragon]] 12:58, 11 June 2006 (EDT) | Is this similar to ''Morrowind's'' Random100 function, or can it be used in the same manner? [[User:TheImperialDragon|The Imperial Dragon]] 12:58, 11 June 2006 (EDT) | ||
:'''Random100''' (as one word) in Morrowind was a global that was set to 0-100 once per frame (in the script "Main") | |||
'''Random100''' (as one word) in Morrowind was a global that was set to 0-100 once per frame (in the script "Main") | |||
set variable to GetRandomPercent | set variable to GetRandomPercent | ||
in Oblivion is the same as | :in Oblivion is the same as | ||
set variable to Random 100 | set variable to Random 100 | ||
in Morrowind and will return a new random number ranging from 0-99 whenever you call it. | :in Morrowind and will return a new random number ranging from 0-99 whenever you call it. | ||
:--[[User:JOG|JOG]] 13:40, 11 June 2006 (EDT) | |||
--[[User:JOG|JOG]] 13:40, 11 June 2006 (EDT) | |||
I see, thank you. [[User:TheImperialDragon|The Imperial Dragon]] 13:44, 11 June 2006 (EDT) | ::I see, thank you. [[User:TheImperialDragon|The Imperial Dragon]] 13:44, 11 June 2006 (EDT) | ||
== Example == | |||
[[User:JOG|JOG]] 17:33, 29 July 2006 (EDT): Here's the math behind the first example: | [[User:JOG|JOG]] 17:33, 29 July 2006 (EDT): Here's the math behind the first example: | ||
Line 84: | Line 83: | ||
== Alternative up to 50 == | |||
Seems to me that for Random Numbers up to 50 you can use this Syntax: | Seems to me that for Random Numbers up to 50 you can use this Syntax: | ||
Line 111: | Line 110: | ||
imul eax, 64h | imul eax, 64h | ||
add edi, eax</pre> | add edi, eax</pre> | ||
From Ian | From Ian Patterson "That function is a wrapper around MS' stdlib rand that calls srand(time(NULL)) if it hasn't been seeded yet. It only uses the system timer once. The rest of the code is just some modular arithmetic done in fixed point."--[[User:Haama|Haama]] 13:42, 25 May 2008 (EDT) |