Skip to content

Commit

Permalink
added random number generation functions inclusive and exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Shah committed Nov 6, 2015
1 parent 2bec95c commit bbfd26f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
};
15 changes: 15 additions & 0 deletions agile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit bbfd26f

Please sign in to comment.