Skip to content

Commit 9a51a29

Browse files
author
Johnny Reina
committed
Adds precision value to faker.random.number call.
1 parent 1f47f09 commit 9a51a29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/finance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ var Finance = function (faker) {
8888
max = max || 1000;
8989
dec = dec || 2;
9090
symbol = symbol || '';
91-
var randValue = faker.random.number({ max: max, min: min });
91+
var randValue = faker.random.number({ max: max, min: min, precision: Math.pow(10, -dec) });
9292

93-
return symbol + (Math.round(randValue * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec);
93+
return symbol + randValue.toFixed(dec);
9494

9595
}
9696

0 commit comments

Comments
 (0)