User Tools

Site Tools


java:numerosaleatorios
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
java:numerosaleatorios [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Cómo crear y generar números aleatorios ======
 +
 +[[http://java.sun.com/javase/6/docs/api/java/util/Random.html]]
 +
 +<code java>
 +import java.util.Random; 
 +
 +Random rnd = new Random(); 
 +
 +rnd.nextInt( 5 );  // devuelve un número entero aleatorio entre 0 y 4 
 +
 +rnd.nextLong(); // retorna un entero largo 
 +
 +</code>
 +
  
java/numerosaleatorios.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1