RandSeeded
A function added by the ShowOff NVSE Plugin.
Contents
Description
Returns a random number between specified Minimum and Maximum, which is based upon the randomizer seed set for the calling mod.
Unlike Rand and GetRandomInRange, the generated number is in the interval min <= x <= max (includes max).
Minimum must be <= to Maximum. Returns -1 if this assertion fails.
- NOTE: for now this check isn't actually in place; the code will just crash if assertion fails. Will be added later though.
If no seed is set for the calling mod, this first generates a default seed (value of 5489).
- NOTE: since the default seed is constant, it will always generate the same sequence of random numbers.
(Behind the scenes, this advances the seed's internal numGenerated count so as to make the next call of RandSeeded/GetRandomPercentSeeded generate the next number in the pseudo-random sequence.)
Syntax
(randomNum:int) RandSeeded Minimum:UInt Maximum:UInt
Or:
(randomNum:int) GenerateSeededRandomNumber Minimum:UInt Maximum:UInt
Example
int iRand let iRand := RandSeeded 1, 6 ; * for 1-6, like a six-sided die roll.
let iRand := RandSeeded 1, 100 ; * for 1-100, equivalent to using GetRandomPercentSeeded.
For both of the examples above, if a seed was not initialized prior with SetRandomizerSeed / SetSeedUsingForm, will generate random values using the default seed.