Sample $n^2$ integers $a_{11},\dots,a_{nn}$ in $0\subsetneq[-d,d]$ uniformly. What is the probability that the resulting matrix $[a_{ij}]$ has rank $r$? What is a good strategy to generate such a rank $r$ matrix quickly deterministically? Is there a nice parametrization of such matrices?