Skip to content

Instantly share code, notes, and snippets.

@surfjedi
Last active August 29, 2015 14:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surfjedi/08dbd54712fb61fc6fd6 to your computer and use it in GitHub Desktop.
Save surfjedi/08dbd54712fb61fc6fd6 to your computer and use it in GitHub Desktop.
A simple random number JS module
var RandomModule = function () {};
RandomModule.prototype.getRandomArbitrary = function (min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
exports.RandomModule = RandomModule;
//to use in another JS file
//var RandomModule = require('./{patho}/random-module.js').RandomModule;
//var randomModule = new RandomModule();
//var random = randomModule.getRandomArbitrary(1, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment