Tes3Mod:Random

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search


Random

                Random, Value

       Where:   Value = One more than the maximum random number you want to generate

        Type:   Misc

     Returns:   short

     Example:   if ( Random, 10 == 5 )          
                set sValue to Random, 100       ; Random number between 0 and 99

     Scripts:   Main
                ouch_sunder

Generates a random number between 0 and (Value - 1).

Note: For notes on reliability of random numbers see the thread Random value question, How do I set it up? on The Elder Scrolls Forums. Summary of relevant info below.

"I've checked the values in a number of different ways and these comments about bad random number generation don't seem to be significant in the Bloodmoon version. I do remember that original Morrowind random numbers were pretty bad in some cases." -cdcooley
"Using the output of [Random, 1000] or [Random, 10000] and then dividing by an appropriate factor (say 100) to scale the number down to what you need, will produce more reliable random outcomes than using [Random, 100] or [Random, 10] directly." -cyran0