SHARE
TWEET

Untitled

a guest Oct 14th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function randomMixingArray(arr) {
  2.   var randomIndex;
  3.   var randomEl;
  4.  
  5.   for (var i = arr.length - 1; i > 0; i--) {
  6.     randomIndex = Math.floor(Math.random() * (i + 1));
  7.     randomEl = arr[randomIndex];
  8.     arr[randomIndex] = arr[i];
  9.     arr[i] = randomEl;
  10.   }
  11.  
  12.   return arr;
  13. }
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
 
Top