3
I cannot return any number. Ex: If I use "lower 1500" and "higher 5000", I would appear in this interval if I did not enter the while
, only nothing is returning.
public int aleatoriar(int maior, int menor) {
int retorno = 0;
Calendar lCDateTime = Calendar.getInstance();
int datarecebe = (int) (lCDateTime.getTimeInMillis());
int recebe = datarecebe % 10000;
if (recebe > maior || recebe < menor) {
while(recebe >= maior && recebe <= menor) {
retorno = recebe;
}
} else {
retorno = recebe;
}
return retorno;
}
Dude, you’re not changing the receipt, how to change the return?
– Felipe Avelar
If you want to generate a random number, is there any reason not to use what Java has ready? Because what you’re doing isn’t exactly random.
– Maniero
Is there a strong reason not to use language packs !?
– Motta