From bbfd26f60ba99c3536d6d7406d9f48207cfffc6d Mon Sep 17 00:00:00 2001 From: Jay Shah Date: Fri, 6 Nov 2015 11:02:40 +0530 Subject: [PATCH] added random number generation functions inclusive and exclusive --- Gruntfile.js | 3 ++- agile.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4445170..a63cd49 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -42,5 +42,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks("grunt-jscs"); - grunt.registerTask('default', ['jshint', 'jscs', 'uglify', 'watch']); + // grunt.registerTask('default', ['jshint', 'jscs', 'uglify', 'watch']); + grunt.registerTask('default', ['jshint', 'jscs', 'watch']); }; \ No newline at end of file diff --git a/agile.js b/agile.js index 8c7ef30..4be01c1 100644 --- a/agile.js +++ b/agile.js @@ -52,6 +52,21 @@ } } + /** + * Returns a random number between min (inclusive) and max (exclusive) + */ + function randFromRangeArb(min, max) { + return Math.random() * (max - min) + min; + } + + /** + * Returns a random integer between min (inclusive) and max (inclusive) + * Using Math.round() will give you a non-uniform distribution! + */ + function randFromRange(min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + } + /** * Convert object to query string * @return `string`