I need to fill a set of specific values in a 2d array in random positions. I already got it set in certain positions but I want it in random positions instead. Here is my Code
private void GenerateRandomBoard()
{
//Put a dot in every spot
int row;
int col;
for (row = 0; row < 4; row++)
{
for (col = 0; col < 4; col++)
{
Console.Write(GameboardArray[row, col] = ".");
}
//Console.WriteLine();
}
//Randomly Places the entrance, dragon, pit and gold.
GameboardArray[0, 0] = "E";
GameboardArray[2, 1] = "D";
GameboardArray[1, 1] = "P";
GameboardArray[1, 3] = "P";
GameboardArray[2, 2] = "P";
GameboardArray[1, 2] = "G";
}
So as you can see instead of where it has GameboardArray[2, 1] = "D";
I just it want it to end up in a random place on the 4, 4 array.