Comparing version 0.5.5 to 0.5.6
@@ -148,20 +148,2 @@ // Chance.js 0.5.5 | ||
Chance.prototype.integer = function (options) { | ||
var num, range; | ||
options = initOptions(options, {min : MIN_INT, max : MAX_INT}); | ||
// Greatest of absolute value of either max or min so we know we're | ||
// including the entire search domain. | ||
range = Math.max(Math.abs(options.min), Math.abs(options.max)); | ||
// Probably a better way to do this... | ||
do { | ||
num = this.natural({max: range}); | ||
num = this.bool() ? num : num * -1; | ||
} while (num < options.min || num > options.max); | ||
return num; | ||
}; | ||
// NOTE the max and min are INCLUDED in the range. So: | ||
@@ -173,7 +155,7 @@ // | ||
Chance.prototype.natural = function (options) { | ||
Chance.prototype.integer = function (options) { | ||
// 9007199254740992 (2^53) is the max integer number in JavaScript | ||
// See: http://vq.io/132sa2j | ||
options = initOptions(options, {min: 0, max: MAX_INT}); | ||
options = initOptions(options, {min: MIN_INT, max: MAX_INT}); | ||
@@ -185,2 +167,7 @@ testRange(options.min > options.max, "Chance: Min cannot be greater than Max."); | ||
Chance.prototype.natural = function (options) { | ||
options = initOptions(options, {min: 0, max: MAX_INT}); | ||
return this.integer(options); | ||
}; | ||
Chance.prototype.normal = function (options) { | ||
@@ -584,3 +571,3 @@ options = initOptions(options, {mean : 0, dev : 1}); | ||
}; | ||
Chance.prototype.altitude = function (options) { | ||
@@ -590,3 +577,3 @@ options = initOptions(options, {fixed : 5}); | ||
}; | ||
Chance.prototype.depth = function (options) { | ||
@@ -596,3 +583,3 @@ options = initOptions(options, {fixed: 5}); | ||
}; | ||
Chance.prototype.latitude = function (options) { | ||
@@ -1093,3 +1080,3 @@ options = initOptions(options, {fixed: 5, min: -90, max: 90}); | ||
options = options || {version: 5}; | ||
var guid_pool = "ABCDEF1234567890", | ||
@@ -1282,5 +1269,5 @@ variant_pool = "AB89", | ||
// Register as a named AMD module | ||
// Register as an anonymous AMD module | ||
if (typeof define === 'function' && define.amd) { | ||
define('Chance', [], function () { | ||
define([], function () { | ||
return Chance; | ||
@@ -1287,0 +1274,0 @@ }); |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121156
2487