Created
August 14, 2013 18:54
-
-
Save calvinmetcalf/6234282 to your computer and use it in GitHub Desktop.
workers!
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
//if your workers are in an array called workers | |
//and your data in one called data | |
var len = data.length; | |
var i = -1; | |
var n = workers.length; | |
while(++i<len){ | |
wokers[~~(Math.random()*n)].postMessage(data[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment