Skip to content

Commit

Permalink
Fixed magic values in number generator formula
Browse files Browse the repository at this point in the history
  • Loading branch information
davinnchii committed Oct 11, 2023
1 parent 59fb53b commit ec1ae27
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/numberGenerator.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

const GET_RANDOM_DIGITS_FORMULA = Math.floor(1000 + Math.random() * 9000);
const UPPER_VALUE = 9000;
const BOTTOM_VALUE = 1000;

function generateNumber() {
return GET_RANDOM_DIGITS_FORMULA.toString();
return Math.floor(BOTTOM_VALUE
+ Math.random() * UPPER_VALUE).toString();
}

module.exports = { generateNumber };

0 comments on commit ec1ae27

Please sign in to comment.