int类型取值范围为[min,max);
int num = Random.Range(1, 3);//在1到2之间取值,不包括3。
float类型取值范围为[min.max]
float num = Random.Range(1.0f, 3.0f);//在1.0f到3.0f之间取值,包括3。
Random.InitState(int seed);
//传入一个int种子(环境),每次执行相同位置得到的随机数保持不变(伪随机)。比如下面的代码,在使用了Random.InitState函数后每帧打印出的随机数都是一样的。
Random.InitState(2);
Debug.Log("First:"+Random.Range(1,10));
Debug.Log("Second:"+ Random.Range(1, 10));
Debug.Log("Third:" + Random.value);
后续如果有使用Random的其他功能再继续补充。
相关链接: Unity3D_(API)Random随机数 UnityManual