Returning a pseudo-random Gaussian number
A do while would be an equivalent construct. I don't really think either is more or less preferable, but is an alternative that avoids the appearance of an infinite loop:

do {
    returningNumber = (generator.nextGaussian() * rangeMean/PERCENT_97) + mean;
} while (returningNumber &lt; min || returningNumber &gt; max);
return returningNumber;


That still leaves open a possibility of an eternal loop, though. You should probably at least validate your params to guard against that (eg., a min of 1 and max of 1 would run forever). You may also want to put an iteration counter to give up and throw an exception after so many iterations. At that point, a for loop with an early return if one is found may be a better choice than stuffing it all into the where or if conditionals:

for (int i = 0; i &lt; MAX_TRIES; i++) {
    returningNumber = (generator.nextGaussian() * rangeMean/PERCENT_97) + mean;
    if (returningNumber &gt; min &amp;&amp; returningNumber &lt; max) {
        return returningNumber;
    }
}
throw new IGiveUpException();