From c4ca4a76690092a9e9dcb0dd942e7807922a18a1 Mon Sep 17 00:00:00 2001 From: RISHAV Date: Sun, 13 Oct 2024 17:49:50 +0530 Subject: [PATCH] fix(random): handle seed initialization correctly The previous implementation used a direct property check (`config.seed`), which could inadvertently treat falsy values like "0" as missing. This caused incorrect random seed initialization in some cases. Changed the condition to explicitly check for the presence of the `seed` property using `Object.prototype.hasOwnProperty.call()`. Now, seed initialization handles falsy but valid seed values correctly. --- lib/node_modules/@stdlib/random/shuffle/lib/factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/random/shuffle/lib/factory.js b/lib/node_modules/@stdlib/random/shuffle/lib/factory.js index 91544cb5ddc..37ab8b64f2b 100644 --- a/lib/node_modules/@stdlib/random/shuffle/lib/factory.js +++ b/lib/node_modules/@stdlib/random/shuffle/lib/factory.js @@ -63,7 +63,7 @@ function factory( config ) { throw err; } } - if ( config && config.seed ) { + if ( config && Object.prototype.hasOwnProperty.call( config, 'seed' ) ) { rand = randu({ 'seed': config.seed });