Created
November 10, 2014 01:19
-
-
Save anubisthejackle/8887048f7efec6a16f71 to your computer and use it in GitHub Desktop.
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
selectID: function(channel){ | |
var id, nick, list = []; | |
if( typeof this.weights[ channel ] == 'undefined' || this.weights[ channel ].length < 1 ){ | |
this.identities[ channel ] = this.nicks[ channel ][ Math.floor( Math.random() * this.nicks[ channel ].length ) ]; | |
return; | |
} | |
for( nick in this.weights[ channel ] ){ | |
list = list.concat( Array(this.weights[ channel ][ nick ]+1).join( nick + ',' ).slice(0, -1).split( ',' ) ); | |
} | |
this.identities[ channel ] = list[ Math.floor( Math.random() * list.length ) ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment