From 94d41c5f142782fca84f82ba478482765b662eba Mon Sep 17 00:00:00 2001 From: Levente Kurusa Date: Tue, 11 Apr 2023 17:44:06 +0200 Subject: [PATCH] node/crypto/randomInt: preserve structure --- ext/node/polyfills/internal/crypto/_randomInt.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/node/polyfills/internal/crypto/_randomInt.ts b/ext/node/polyfills/internal/crypto/_randomInt.ts index a8434b5f4c0165..88636d2d6096e7 100644 --- a/ext/node/polyfills/internal/crypto/_randomInt.ts +++ b/ext/node/polyfills/internal/crypto/_randomInt.ts @@ -42,6 +42,8 @@ export default function randomInt( throw new Error("Min is bigger than Max!"); } + min = Math.ceil(min); + max = Math.floor(max); const result = ops.op_node_random_int(min, max); if (cb) {