Ver Mensaje Individual
Antiguo 17-abr-2008, 04:01   #2 (permalink)
taar
taar está en el buen camino
 
Fecha de Ingreso: noviembre-2002
Ubicación: Asuncion
Mensajes: 133
Re: Numeros aleatorios

Se me ocurre uno: primero guardas los numeros en un array y luego accede a sus indices. Deberia ser algo asi:
Código:
int[] n = {20,33,40}; 
int i = n[ (int) Math.round(Math.random()) * (n.length-1) ];
System.out.println(i);
taar está desconectado   Responder Citando