Let's say that I have a
bool[,] with random values
FFFFFFFF FFFFFTTT TTTTTTTT FFFFFFFF
What would be the smartest way to create a new
bool[,] that build on top of the previous one. That means, that it can have random values where the previous one was
true, but that it preserves the
falses from the original?
So this could be a possible result
FFFFFFFF FFFFFTFT TTFFFTTT FFFFFFFF
But this not...
TTTTTFFF TTTTTFFF TTTTTTTT FFFFFFFF
So far I have come with the classical solution. First create a matrix of random values, and the overwrite them.
for (int x = 0; x < cols; x++) for (int y = 0; y < rows; y++) if (matrix1[x, y] == false) matrix2[x, y] = false;
But I was wondering if there is a better way.