[JS] jQuery random number plugin
I’ve taken this little piece of code around the Web (sorry, I forgot the original source) and it’s a good example on how to develop a plugin for jQuery:
/** Usage:
* $.random(int);
* $.randomBetween(min, max); */
jQuery.extend({
random: function(X) {
return Math.floor(X * (Math.random() % 1));
},
randomBetween: function(MinV, MaxV) {
return MinV + jQuery.random(MaxV - MinV + 1);
}
});