1.C#自带随机数函数
using System;
System.Random ran = new System.Random();
int n = ran.Next(100, 1000);//产生100到999之间的随机整数
Debug.Log (n);
2.Unity自带随机数函数
using UnityEngine;
float f = UnityEngine.Random.value;//产生0到1之间的随机数
Debug.Log(f);
原文:http://www.cnblogs.com/huangshiyu13/p/5990191.html