JS random sort test

a guest May 30th, 2017 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f=n=>[...Array(n+1).keys()].sort(_=>.5-Math.random());
  2. a=[0,0,0,0,0,0];
  3. for(n=0;n<1e5;n++){p=f(5);for(i=0;i<6;i++)a[p[i]]+=i;}
  4. console.log(>x/1e5))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand