I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the following criteria:
- The length of list $M$ has to be exactly the size of a fixed percentage between $10%$ to $50%$ of $n\cdot m$. So, I choose this value.
- A valid position $(i,j)$ is when $1\leq i\leq n$, $1\leq j\leq m$, and
- If after we locate the positions of $M$ in the matrix $X$ painting them with "green", neither a column can be "green" nor a row. Indeed, both a row and a column must have at least two positions "white".
- The list $M$ has to be generated randomly.
I'd already done it, but the second restriction seems to so hard to fulfill. And, the code is so slow. My code is something around the use of RandomChoice
. newij = RandomChoice[Outer[List, Range[n], Range[m]]; paint[newij];
do until we have all conditions.
This can be one of those random "paintings" for the matrix $X$: