Probability-based random number generation fix

The accidentally overwritten code was revived