Could you please tell me why I can't make a random double like a random int? When I try to random double? I tried with many options, but everytimes it does not work It's get a error: nextDouble() in java.util.Random cannot be applied to ('double'):
Thanks for advance!
public static int generateRandomInRange (int start, int finish){
Random rnd = new Random();
int numberR = rnd.nextInt(finish + 1 - start) + start;
return numberR;
}
public static double generateDoubleRandomInRange (double start, double finish){
Random rnd = new Random();
Double numberD = rnd.nextDouble(finish + 1 - start) + start;
return numberD;
}
Aucun commentaire:
Enregistrer un commentaire