fork(2) 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. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int diff = 0;
  13. for (long seed = 0 ; seed != 1000 ; seed++) {
  14. Random rndOne = new Random(seed);
  15. List<Integer> one = make();
  16. Collections.shuffle(one, rndOne);
  17. Random rndTwo = new Random(seed);
  18. List<Integer> two = make();
  19. Collections.shuffle(two, rndTwo);
  20. boolean same = true;
  21. for (int i = 0 ; i != 52 ; i++) {
  22. if (one.get(i).equals(two.get(i))) {
  23. continue;
  24. }
  25. same = false;
  26. break;
  27. }
  28. if (!same) {
  29. diff++;
  30. System.out.println("Different when seed="+seed);
  31. }
  32. }
  33. System.out.println("Number of differences: "+diff);
  34. }
  35. public static List<Integer> make() {
  36. List<Integer> items = new ArrayList<>();
  37. for (int i = 0 ; i != 52 ; i++) {
  38. items.add(i);
  39. }
  40. return items;
  41. }
  42. }
Success #stdin #stdout 0.13s 30700KB
stdin
Standard input is empty
stdout
Number of differences: 0