Advertisement
0no

Gera números aleatórios

0no
Oct 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. // Cria 500 números aleatórios que vão de 0 a 99999
  2.  
  3. import java.util.Arrays;
  4.  
  5. class Inicio{
  6.     public static void main(String[] args) {
  7.         int quantidadeDeNumeros = 500;
  8.         int[] numeros = new int[quantidadeDeNumeros];
  9.         for(int i = 0; i < numeros.length; i++) {
  10.             numeros[i] = (int)  (int) (Math.random() * (100000 - 0)) + 0;
  11.         }
  12.         System.out.println(Arrays.toString(numeros));
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement