Avoid duplicates in sprand

While fixing #4723, I noticed that `sprand()` often provided matrices of lower density than requested. At the cost of slower performance, here's a fix. Do we want this? If so, do we need to use more sophisticated sampling procedures (as in Distributions)?