What do you think would happen in this code? Code (CSharp): using UnityEngine; using System.Collections; public class RandomRangeTest : MonoBehaviour { void Update () { int test = Random.Range (0, 3); if (test == 3) print ("I was wrong"); else print ("Why it never reachs 3?"); } }
Random.Range(0, 3); will return one of the three values : 0 - 1 - 2 if the variable is an int. Here : http://docs.unity3d.com/ScriptReference/Random.Range.html Int is exclusive, float is inclusive.
Thx... I checked that but I didn't notice the difference between float and int. At least it's handy when you use it for index.