📜  随机播放列表 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:52.693000             🧑  作者: Mango

代码示例4
//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;