aboutsummaryrefslogtreecommitdiff
path: root/lib/commerce.js
diff options
context:
space:
mode:
authorBen Southgate <[email protected]>2015-12-02 23:02:18 -0800
committerMarak <[email protected]>2016-03-03 05:14:05 -0500
commitd2a70d71817e2b4e1062a0bc777933705bf1c626 (patch)
tree0505dfb1579757fdf33051e9383100dc61ea3a95 /lib/commerce.js
parentc4c7a695f8121566d3536997d118b3c85ddff188 (diff)
downloadfaker-d2a70d71817e2b4e1062a0bc777933705bf1c626.tar.xz
faker-d2a70d71817e2b4e1062a0bc777933705bf1c626.zip
remove Math.random() calls to utilize faker.seed()
Conflicts: lib/internet.js lib/random.js
Diffstat (limited to 'lib/commerce.js')
-rw-r--r--lib/commerce.js23
1 files changed, 4 insertions, 19 deletions
diff --git a/lib/commerce.js b/lib/commerce.js
index 2c41455c..e5a35ee7 100644
--- a/lib/commerce.js
+++ b/lib/commerce.js
@@ -22,24 +22,7 @@ var Commerce = function (faker) {
* @param {number} fixedAmount
*/
self.department = function(max, fixedAmount) {
-
return faker.random.arrayElement(faker.definitions.commerce.department);
- /*
- max = max || 3;
-
- var num = Math.floor((Math.random() * max) + 1);
- if (fixedAmount) {
- num = max;
- }
-
- var categories = faker.commerce.categories(num);
-
- if(num > 1) {
- return faker.commerce.mergeCategories(categories);
- }
-
- return categories[0];
- */
};
/**
@@ -72,7 +55,9 @@ var Commerce = function (faker) {
return symbol + 0.00;
}
- return symbol + (Math.round((Math.random() * (max - min) + min) * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec);
+ var randValue = faker.random.number({ max: max, min: min });
+
+ return symbol + (Math.round(randValue * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec);
};
/*
@@ -131,4 +116,4 @@ var Commerce = function (faker) {
return self;
};
-module['exports'] = Commerce; \ No newline at end of file
+module['exports'] = Commerce;