I would like to see peoples examples of how you would randomize a grid with different values. this is the original board
string[,] board = new string[4, 4];
for (int y = 0; y < 4; y++)
{
for (int x = 0; x < 4; x++)
{
board[x, y] = ".";
}
}
I'm trying to figure out how to place random characters instead of the "." the problem is the amount of each value that needs to be populated. For example there should be 1 "E" populated and 1 "T" populated but thee rest of the grid needs to be "N" and "L" the amount doesn't matter.
I've tried doing it this way and it didn't work
string[] values{"N", "L"}
int index = rand.Next(values.Length);
board[0, 0] = values[index];
board[0, 1] = values[index];
board[0, 2] = values[index];
board[0, 3] = values[index];
//etc...```
I've looked around and can't seem to find any example of what I'm trying to do.
You can try the following code: