Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created August 14, 2013 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/6234282 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6234282 to your computer and use it in GitHub Desktop.
workers!
//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