Java - INCONVENIENTE CON Math.random

 
Vista:

INCONVENIENTE CON Math.random

Publicado por martin (4 intervenciones) el 08/05/2008 02:53:16
CON EL SIGUIENTE CODIGO YO CONSIGO UN NUMERO ENTRE EL 0 Y EL 25, BIEN YO NO QUIERO UN NUMERO ALEATORIO, NECESITO GENERAR 100 NUMEROS AL AZAR ENTRE UN RANGO DE VALORES Y NO SE COMO HACERLO. DESDE YA MUCHAS GRACIAS.

public class EjAleatorios {
public static void main(String[] args) {
int numeroAleatorio = (int) (Math.random()*25+0);
System.out.println(numeroAleatorio);
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:INCONVENIENTE CON Math.random

Publicado por Luis Castro (80 intervenciones) el 08/05/2008 04:28:23
oye ponlo en un for y lo guardas en un arreglo
for c =0
de 0 a 100

array [0]= (int) (Math.random()*25+0);

fin de for

ya tienes la idea chambea sobre eso

lo puse en seudocodigo para que tu solo lo hagas no esta dificil es programacion estructurada lee sobre eso..
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar