Difference between revisions of "Talk:GetRandomPercent"
imported>JOG |
imported>JOG |
||
Line 22: | Line 22: | ||
set dice to 1 + 0.06 * GetRandompercent | set dice to 1 + 0.06 * GetRandompercent | ||
1 + int(0.06 * '''0''') = 1 + 0 = '''1''' | 1 + int(0.06 * '''0''') = 1 + 0 = '''1''' | ||
1 + int(0.06 * '''99''') = 1 + int(5.94) | 1 + int(0.06 * '''16''') = 1 + int(0.96) = 1 + 0 = '''1''' => Chance: 17% | ||
1 + int(0.06 * '''17''') = 1 + int(1.02) = 1 + 1 = '''2''' | |||
1 + int(0.06 * '''33''') = 1 + int(1.98) = 1 + 1 = '''2''' => Chance: 17% | |||
1 + int(0.06 * '''34''') = 1 + int(1.02) = 1 + 2 = '''3''' | |||
1 + int(0.06 * '''49''') = 1 + int(2.94) = 1 + 2 = '''3''' => Chance: 16% | |||
1 + int(0.06 * '''50''') = 1 + int(3.00) = 1 + 3 = '''4''' | |||
1 + int(0.06 * '''66''') = 1 + int(3.96) = 1 + 3 = '''4''' => Chance: 17% | |||
1 + int(0.06 * '''67''') = 1 + int(4.02) = 1 + 4 = '''5''' | |||
1 + int(0.06 * '''83''') = 1 + int(4.98) = 1 + 4 = '''5''' => Chance: 17% | |||
1 + int(0.06 * '''84''') = 1 + int(5.04) = 1 + 5 = '''6''' | |||
1 + int(0.06 * '''99''') = 1 + int(5.94) = 1 + 5 = '''6''' => Chance: 16% |
Revision as of 16:46, 29 July 2006
Is this similar to Morrowind's Random100 function, or can it be used in the same manner? 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")
set variable to GetRandomPercent
in Oblivion is the same as
set variable to Random 100
in Morrowind and will return a new random number ranging from 0-99 whenever you call it.
--JOG 13:40, 11 June 2006 (EDT)
I see, thank you. The Imperial Dragon 13:44, 11 June 2006 (EDT)
JOG 17:33, 29 July 2006 (EDT): Here's the math behind the first example:
short dice set dice to 1 + 0.06 * GetRandompercent
1 + int(0.06 * 0) = 1 + 0 = 1
1 + int(0.06 * 16) = 1 + int(0.96) = 1 + 0 = 1 => Chance: 17%
1 + int(0.06 * 17) = 1 + int(1.02) = 1 + 1 = 2
1 + int(0.06 * 33) = 1 + int(1.98) = 1 + 1 = 2 => Chance: 17%
1 + int(0.06 * 34) = 1 + int(1.02) = 1 + 2 = 3
1 + int(0.06 * 49) = 1 + int(2.94) = 1 + 2 = 3 => Chance: 16%
1 + int(0.06 * 50) = 1 + int(3.00) = 1 + 3 = 4
1 + int(0.06 * 66) = 1 + int(3.96) = 1 + 3 = 4 => Chance: 17%
1 + int(0.06 * 67) = 1 + int(4.02) = 1 + 4 = 5
1 + int(0.06 * 83) = 1 + int(4.98) = 1 + 4 = 5 => Chance: 17%
1 + int(0.06 * 84) = 1 + int(5.04) = 1 + 5 = 6
1 + int(0.06 * 99) = 1 + int(5.94) = 1 + 5 = 6 => Chance: 16%