Code example for Random

Methods: nextDouble

0
    } 
 
    @Override 
    public double getActualRuntime(double runtime) {
        // Get a random number in the range [-1,+1] 
        double plusorminus = (random.nextDouble() * 2.0d) - 1.0d;
        return runtime + (plusorminus * variance * runtime);
    } 
 
    public static void main(String[] args) {
        RuntimeDistribution d = new UniformRuntimeDistribution(0, 0.20);
 
        for (int i = 0; i < 1000; i++) {
            System.out.println(d.getActualRuntime(100));
        } 
    } 
}