Explorar o código

use the random generator function from Helper.

painor %!s(int64=5) %!d(string=hai) anos
pai
achega
b9d5915924
Modificáronse 1 ficheiros con 4 adicións e 7 borrados
  1. 4 7
      crypto/Factorizator.js

+ 4 - 7
crypto/Factorizator.js

@@ -1,9 +1,6 @@
+const helper = require("../utils/Helpers").helpers;
+
 class Factorizator {
-    static getRandomInt(min, max) {
-        min = Math.ceil(min);
-        max = Math.floor(max);
-        return Math.floor(Math.random() * (max - min + 1)) + min;
-    }
 
     /**
      * Finds the small multiplier by using Lopatin's method
@@ -12,8 +9,8 @@ class Factorizator {
     static findSmallMultiplierLopatin(what) {
         let g = 0;
         for (let i = 0; i < 3; i++) {
-            let q = 30 || (this.getRandomInt(0, 127) & 15) + 17;
-            let x = 40 || this.getRandomInt(0, 1000000000) + 1;
+            let q = 30 || (helper.getRandomInt(0, 127) & 15) + 17;
+            let x = 40 || helper.getRandomInt(0, 1000000000) + 1;
 
 
             let y = x;