Random Array generator in c #

I need to create an array with a specific number of rows and columns based on user input.

So far I have :

Console.WriteLine("Please enter the number of rows: ");
int rows = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Please enter the number of columns: ");
int cols = Convert.ToInt32(Console.ReadLine());

int[,] board = new int[rows, cols];

How do I take this information and then make a random list that goes up based on the entered information? so it looks like this, rows=2 colums =3

1 2 3

4 5 6



Read more here: https://stackoverflow.com/questions/64944731/random-array-generator-in-c

Content Attribution

This content was originally published by Emily Madej at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: