From 602d810aef1eebef219b274fc5bfdd42c3ec819d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 10 Feb 2023 12:52:44 +0100 Subject: [PATCH] refactor(simulator): remove unneeded intermediate variable in helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/Utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index ab2a8a5f..1f17fe87 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -128,8 +128,7 @@ export default class Utils { if (max - min === Infinity) { throw new RangeError('Invalid interval'); } - const randomPositiveFloat = crypto.randomBytes(4).readUInt32LE() / 0xffffffff; - return randomPositiveFloat * (max - min) + min; + return (crypto.randomBytes(4).readUInt32LE() / 0xffffffff) * (max - min) + min; } public static getRandomInteger(max = Constants.MAX_RANDOM_INTEGER, min = 0): number { -- 2.34.1