better distribution in the random algorithm (close #1)