Sample $n^2$ integers $a_{11},\dots,a_{nn}$ in $[-d,d]$ uniformly. What is the probability that the resulting matrix $[a_{ij}]$ has rank $r$?