如何在Unity3d中调用随机函数

How to call a random function in Unity3d

在 iOS 我会简单地使用这个;

if (arc4random() % 2 == 0) {
        //Do 1 Thing
    }else{
       // Do another
    }

除了使用 Unity3D 之外,还有什么方法是相同的?

来自unity's documentation

if (Random.Range(minVal, maxVal) % 2 == 0) {
        //Do 1 Thing
} else {
       // Do another
}

已输入随机值。

 if(Random.Range(-10000, 10000)%2==0)