creating matrix with probabilities
<p>I want to generate a matrix of NxN to test some code that I have where each row contains floats as the elements and has to add up to 1 (i.e. a row with a set of probabilities).  </p>

<p>Where it gets tricky is that I want to make sure that randomly some of the elements should be 0 (in fact most of the elements should be 0 except for some random ones to be the probabilities).  I need the probabilities to be 1/m where m is the number of elements that are not 0 within a single row.  I tried to think of ways to output this, but essentially I would need this stored in a C++ array.  So even if I output to a file I would still have the issue of not having it in array as I need it.  At the end of it all I need that array because I want to generate a Market Matrix file.  I found an implementation in C++ to take an array and convert it to the market matrix file, so this is what I am basing my findings on.  My input for the rest of the code takes in this market matrix file so I need that to be the primary form of output.  The language does not matter, I just want to generate the file at the end (I found a way mmwrite and mmread in python as well)</p>

<p>Please help, I am stuck and not really sure how to implement this.</p>
