I have to generate a random matrix with the following characteristics: A nxn (for the example 3x3) matrix, then pick a random element (i,j), say (2,3) and use it in the program to fill a cell in with a random number between 0 and 1 (uniform distribution works). If the sum of that column (3) is greater than 1, then that random number becomes 0, if not, it continues to be that random number. Then, I should continue with the other elements, see that (2,3) is not longer in my options:
(1, 1), (1,2), (1,3), (2,1), (2,2), …, (3,1), (3,2), (3,3)
And we now select randomly from this set, say (1,1), do the same (if the sum column of 1 is greater than 1, then (1,1) becomes 0). Then we have:
…, (1,2), (1,3), (2,1), (2,2), …, (3,1), (3,2), (3,3)
Any suggestion?
Aucun commentaire:
Enregistrer un commentaire