I have a problem with my program. I want to set up how much indexes have my array and then for each index make his own random value. Instead of that loop foreach make one value to each index. I tried with for and Length of array but it didn't work. What I've done wrong?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Set the number of arguments in mineArray:");
string argumentsNumber = Console.ReadLine();
int argumentsNumberInt = Convert.ToInt32(argumentsNumber);
int[] mineArray = new int[argumentsNumberInt];
//set up values to each index of array
for (int i = 0; i < mineArray.Length; i++)
{
Random rand = new Random();
mineArray[i] = rand.Next(0, 100);
Console.WriteLine(Convert.ToString(mineArray[i]));
}
//end of the program
Console.ReadLine();
}
}
}