/// <summary> /// 产生符合指定概率的离散分布的随机数组。 /// </summary> /// <param name="n">随机数组的大小。</param> /// <param name="probabilities">各取值的概率数组。</param> /// <returns>符合指定概率的离散分布的随机数组。</returns> public static double[] GetDiscretDistributionArray(int n, double[] probabilities) { var array = new double[n]; for (var i = 0; i < n; i++) { array[i] = SortUtil.Discrete(probabilities); } return(array); }