This function is good for probabilities where returning an integer (whole number) is not necessary. For example, random(100) will return a value from 0 to 99, but that value can be 22.56473! You can also use real numbers and not integers in this function like this - random(0.5), which will return a value between 0 and 0.4999999.注意：每次游戏重新运行时，此函数将返回相同的值，因为GameMaker Studio 2每次生成相同的初始随机种子，使调试代码变得更容易。要避免这种行为，请在游戏开始时使用随机化。
|n||The upper range from which the random number will be selected.|
if random(10) >= 9
score += 100;
This will produce approximately a one in ten chance of adding 100 to the score.