Reduce _.compact and revert _.random use in _.shuffle.

Former-commit-id: 17d153cb09c262830f1497f93c0f3d9b279c8f8a
This commit is contained in:
John-David Dalton
2012-10-07 18:43:20 -07:00
parent 0a1036c78f
commit 9c8e1f4706
2 changed files with 5 additions and 4 deletions

View File

@@ -138,7 +138,7 @@
'reject': ['identity'],
'rest': [],
'result': ['isFunction'],
'shuffle': ['random'],
'shuffle': [],
'size': ['keys'],
'some': ['identity'],
'sortBy': ['identity'],

View File

@@ -2396,8 +2396,9 @@
result = [];
while (++index < length) {
if (array[index]) {
result.push(array[index]);
var value = array[index];
if (value) {
result.push(value);
}
}
return result;
@@ -2860,7 +2861,7 @@
result = Array(length);
while (++index < length) {
var rand = random(index);
var rand = nativeFloor(nativeRandom() * (index + 1));
result[index] = result[rand];
result[rand] = array[index];
}