随机概率

随机概率就像彩票,有时赢,有时输。

要使用随机概率,使用条件分歧:

localPercentage(target, percentage)

例如

localPercentage(this, 50)

这一情况下,会有50%的概率返回true。