Okay so this is a pickle for those who like math, probability and coding. I'm converting this diceroller plugin from godot 3.5 to 4.0. It's a pretty big deal since i can publish it to the asset store!
Most of the functions converts fine. However at least one of them does not work after converting to 4.0 and the scripts seem to look excactly the same.
So the function rolls two twentysided dice (d20) and returns the highest number (called advantage in D&D lingo). However the advantage isn't working. When i roll the dice a lot it evens out randomly like i'm only rolling one die or it picks the same one everytime. I should get better than average results and somehow that only happens in godot 3.5. Not in Godot 4.0. Even though the scripts are identical.
Hope someone can help. The script is in the first reply due to message length.