Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

shuffle list

//Shuffles a list using durstenfeld algorithm
shuffle(a)
var j, m, i
for (i = a.length - 1; i > 0; i--) {
  j = Math.floor(Math.random() * (i + 1));
  m = a[i]
  a[i] = a[j]
  a[j] = m;
}
return a;
Source by pynative.com #
 
PREVIOUS NEXT
Tagged: #shuffle #list
ADD COMMENT
Topic
Name
1+4 =