c#-随机数组

    public static int[] GenerateRandowArray(int maxSize,int maxValue)
    {
        Random rd = new Random();
        int[] arr = new int[(int)((maxSize+1) * rd.NextDouble ())];
        for(int i=0; i<arr.Length; i++)
        {
            arr[i] = (int)((maxValue+1) * rd.NextDouble())-(int)((maxValue) * rd.NextDouble());
        }
        return arr;
    }

 

posted @ 2023-05-01 09:05  vba是最好的语言  阅读(17)  评论(0编辑  收藏  举报