public static List<T> MyRandom<T>(ref List<T> tras, int number) { if (number > tras.Count) { Debug.Log("要取的个数大于数组长度!"); return null; } List<T> result = new List<T>(); List<int> Numid = new List<int>(); for (int i = 0; i < tras.Count; i++) { Numid.Add(i); } int r; while (Numid.Count > tras.Count - number) { r = UnityEngine.Random.Range(0, Numid.Count); result.Add(tras[Numid[r]]); Numid.Remove(Numid[r]); } return (result); }