Actually it seems that the random matrix function does not like discrete uniform distributions as an argument.
Here is what I worked out:
I basically cycle through the storage of the matrix and use the result of a random number to assign some entries to 0.0
Here is a function in VB.net:
Public Function Mask(ByRef Matrix As DenseMatrix, ByVal proportion_zero As Double) As DenseMatrix
Dim Masked As DenseMatrix = Matrix.Clone
For r = 0 To Matrix.RowCount  1
For c = 0 To Matrix.ColumnCount  1
If Rnd() < proportion_zero Then
Masked.Storage(r, c) = 0
End If
Next c
Next r
Return Masked
End Function
The arguments are Matrix(the matrix to mask), and proportion_zero (the proportion of entries which should be zero).
The function returns the result of the masking.
