THIS IS NOT THE MOST EFFICIENT WAY TO DO THIS. BUT IT IS THE EASIEST IN MY OPINION:

Okay consider this:
Start with random being equal to 0;
While your random number is smaller than the smallest...