In some cases the implemented Mersenne Twister RNG will return an invalid value of 1 in the RandDouble function, which can cause runtime errors in other functions that utilize it.
Numbered Steps to Reproduce Problem:
Run the below snippet anywhere and a runtime out of bounds error will happen on the last pick outside the loop.
Code Snippet (if applicable) to Reproduce Problem:
var/list/stuff = list(1,2,3,4,5)
rand_seed(48)
for(var/i in 1 to 245380)
var/p = pick(stuff)
var/p = pick(stuff) // runtime
Expected Results:
Expected values for the generator would be in the interval [0,1). Expected result for the code snippet would be no runtime errors.
Actual Results:
Actual values the generator can return are in the interval [0,1]. Actual result from the snippet is an unexpected runtime error.
Workarounds:
Use pick in a try-catch block and when it captures an OOB error retry the pick again.