SOURCE

var students = ['学生1', '学生2', '学生3', '学生4', '调皮学生'];

function rd(arr) {
    var length = arr.length, rdIndex, temp;

    for(var i = length-1; i>=0; i--) {
        rdIndex = Math.floor(Math.random()*(length-1));
        temp = arr[rdIndex];
        arr[rdIndex] = arr[i];
        arr[i] = temp;
    }
    return arr;
}

document.write(rd(students));
console 命令行工具 X clear

                    
>
console