How to use the random function from underscore
Find comprehensive JavaScript underscore.random code examples handpicked from public code repositorys.
2116 2117 2118 2119 2120 2121 2122 2123 2124 2125
_.shuffle = function(obj) { var rand; var index = 0; var shuffled = []; each(obj, function(value) { rand = _.random(index++); shuffled[index - 1] = shuffled[rand]; shuffled[rand] = value; }); return shuffled;
0
2
0
underscore.keys is the most popular function in underscore (11266 examples)