forked from nko/website
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Visnu Pitiyanuvath
committed
Jul 23, 2011
1 parent
45f34f6
commit 9747b65
Showing
4 changed files
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_ = module.exports = require 'underscore' | ||
|
||
_.mixin | ||
shuffle: (array) -> | ||
shuffled = [] | ||
_.each array, (value, index, list) -> | ||
if index == 0 | ||
shuffled[0] = value | ||
else | ||
rand = Math.floor(Math.random() * (index + 1)) | ||
shuffled[index] = shuffled[rand] | ||
shuffled[rand] = value | ||
shuffled |