fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.Arrays;
  4. import java.util.function.Consumer;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9.  
  10. public static void main(String[] args){
  11. int[] array = {1,2,3,4,5,6,7,8,9,10};
  12. new Ideone().a.accept(array);
  13. System.out.println(Arrays.toString(array));
  14. }
  15.  
  16. Consumer<int[]> a = a->{for(int b=0,c,d=0,e=a.length;b<e;c=a[b],a[b]=a[d],a[d]=c,b++,d=b)d+=Math.random()*(e-b);};
  17. }
Success #stdin #stdout 0.17s 320448KB
stdin
Standard input is empty
stdout
[2, 4, 3, 9, 6, 7, 8, 5, 10, 1]