Generating random numbers I'm trying to refactor the following code and could use some suggestions.  Basically, three functions generating random numbers in different ways are called:

import java.util.Random;
public final class JP_RandomNumbers {

    /**
     * @param aArgs
     */

    public static void main(String[] aArgs) {
        genRandomNumbers1();
        genRandomNumbers2();
        genRandomNumbers3();
    }

    private static void genRandomNumbers1() {
        log("Generating 10 random integers in range 0..99.");

        //note that a single Random object is reused here
        Random randomGenerator = new Random();
        for (int idx = 0; idx &lt; RANGE ; ++idx) { 
            int randomInt = randomGenerator.nextInt(100);
            log("Generated :" + randomInt);
        }
        log("Done.");

    }

    private static void genRandomNumbers2() { 
        //Generating random numbers in a specific range
        int START = 1;
        int END = 10;

        Random random = new Random();
        for (int idx = 1 ; idx &lt;= 10 ; ++idx) {
            showRandomInteger(START, END, random);
        }
        log ("Done");

    }

    private static void showRandomInteger(int aStart, int aEnd, Random aRandom) { 
        if(aStart &gt; aEnd) throw new IllegalArgumentException("Start cannot exceed End.");

        //get the range, casting to avoid overflow problems
        long range = (long)aEnd - (long) aStart + 1;
        //compute a fraction of the range , 0 &lt;= frac &lt;= range
        long fraction = (long) (range * aRandom.nextDouble());
        int randomNumber = (int)(fraction + aStart);
        log("Generated : " + randomNumber);
    }

    private  void genRandomNumbers3() { 
        double MEAN = 100.0f;
        double VARIANCE = 5.0f;
        for(int idx = 1; idx &lt;= 10; ++idx){
            log("Generated : " + String.valueOf(getGaussean(MEAN,VARIANCE)));       
        }
        log ("Done");

    }

    private double getGaussean(double aMean, double aVariance){
        return aMean + fRandom.nextGaussian() * aVariance;
    }

    //Private 
    private static final int RANGE = 10;
    private Random fRandom = new Random();
    private static void log( String aString) { 
        System.out.println(aString);
    }

}


Output: 

Generating 10 random integers in range 0..99.
Generated :74
Generated :99
Generated :75
Generated :15
Generated :32
Generated :31
Generated :96
Generated :61
Generated :80
Generated :89
Done.
Generated : 2
Generated : 4
Generated : 1
Generated : 9
Generated : 9
Generated : 5
Generated : 9
Generated : 4
Generated : 3
Generated : 7
Done
Generated : 96.16324820042756
Generated : 97.4298343909747
Generated : 105.18654272922421
Generated : 90.56523225378042
Generated : 100.26474837892167
Generated : 99.13288502577953
Generated : 105.99193834986883
Generated : 101.21081536019025
Generated : 99.48291677422242
Generated : 100.55524156214658
Done
The number generation technique is generally sound.  I just have the following minor suggestions:


The idiomatic way to repeat something 10 times is

for (int idx = 0 ; idx &lt; 10 ; ++idx) { … }

Use the fRandom instance variable; you shouldn't need to create new Random() in each function.
You hard-coded values in each function; those constants should probably be pulled out to the class level.
showRandomInteger() should be changed to return a random value instead of logging it.
The compiler will implicitly do String.valueOf() for you, so you can just write

log("Generated : " + getGaussean(MEAN,VARIANCE));

getGaussean() should be spelled getGaussian().