Create Random Array - CSharp System

CSharp examples for System:Array Create

Description

Create Random Array

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*  w  w  w  . j  a va2 s . c o  m*/

public class Main{

        public static int[] CreateRandomArray(int count, int maxValue = 100)
        {
            int[] data = new int[count];
            for (int i = 0; i < count; i++)
            {
                data[i] = rand.Next(1, maxValue);
            }
            return data;
        }
}

Related Tutorials