Code example for Random

Methods: nextDouble

0
        if( quantity<0 || cost<0) return 0.0;
        return quantity *  cost ;
    } 
 
    public Boolean multiplyByRandom(double amount) {
        Random random = new Random();
        double randomNumber=random.nextDouble();
        double result = amount*randomNumber ;
        return true; 
    } 
}