fork(1) 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. System.out.print("[");
  13.  
  14. for (int i = 0; i < massiv.length; i++) {
  15. massiv[i] = sluchaynoeCeloe();
  16.  
  17. if (i != 0) {
  18. System.out.print(", ");
  19. }
  20.  
  21. System.out.print(massiv[i]);
  22. }
  23.  
  24. System.out.println("]");
  25. }
  26.  
  27. public static int sluchaynoeCeloe() {
  28. int a = -7, b = 13;
  29. return (int)(Math.random() * (b + (Math.abs(a) + 1))) - Math.abs(a);
  30. }
  31. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
[1, 11, 10, -5, -6, -2, -7, -6, -4, -2, 7, 11, -1, -5, 4, 5, -5, 5, 10, -6]