diff options
| author | Marak <[email protected]> | 2014-09-11 18:24:06 +0200 |
|---|---|---|
| committer | Marak <[email protected]> | 2014-09-11 18:28:30 +0200 |
| commit | 14b42846fef60bb0d1493a561d0b9aaa40a95bfc (patch) | |
| tree | 112a8fa8950553983ed098f7460482c1302a46a4 /lib/helpers.js | |
| parent | 198032b5d37a4882fc7d19d273475bb087685f2e (diff) | |
| download | faker-14b42846fef60bb0d1493a561d0b9aaa40a95bfc.tar.xz faker-14b42846fef60bb0d1493a561d0b9aaa40a95bfc.zip | |
[api] [refactor] Replaced Math.Random calls with Random.number. Random ranges are now inclusive of max instead of exclusive. #88 #48
Diffstat (limited to 'lib/helpers.js')
| -rw-r--r-- | lib/helpers.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/helpers.js b/lib/helpers.js index 4dda368a..7d146c8d 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -25,7 +25,7 @@ exports.replaceSymbolWithNumber = function (string, symbol) { var str = ''; for (var i = 0; i < string.length; i++) { if (string[i] == symbol) { - str += Math.floor(Math.random() * 10); + str += faker.random.number(9); } else { str += string[i]; } @@ -35,7 +35,7 @@ exports.replaceSymbolWithNumber = function (string, symbol) { // takes an array and returns it randomized exports.shuffle = function (o) { - for (var j, x, i = o.length; i; j = parseInt(Math.random() * i, 10), x = o[--i], o[i] = o[j], o[j] = x); + for (var j, x, i = o.length; i; j = faker.random.number(i), x = o[--i], o[i] = o[j], o[j] = x); return o; }; |
