fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. public static void main(String[] args) {
  10. int massiv[] = new int[20];
  11.  
  12. for (int i = 0; i < massiv.length; i++) {
  13. massiv[i] = sluchaynoeCeloe();
  14. }
  15.  
  16. System.out.println(Arrays.toString(massiv));
  17. }
  18.  
  19. public static int sluchaynoeCeloe() {
  20. int a = -7, b = 13;
  21. return (int)(Math.random() * (b + (Math.abs(a) + 1))) - Math.abs(a);
  22. }
  23. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
[12, 3, 9, -5, 0, -4, 13, 8, -5, -3, -2, 8, 7, -2, 7, -5, 11, 5, -5, 7]