From d06f40be44af919cfb4df2a2afb4e804098e2770 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 08:49:14 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Fix=20insecure=20randomness=20in?= =?UTF-8?q?=20Smart=20Pick=20Generator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: artosien <65523959+artosien@users.noreply.github.com> --- src/components/generator/smart-pick-generator.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/generator/smart-pick-generator.tsx b/src/components/generator/smart-pick-generator.tsx index 0f235bd..6369700 100644 --- a/src/components/generator/smart-pick-generator.tsx +++ b/src/components/generator/smart-pick-generator.tsx @@ -50,7 +50,10 @@ export function SmartPickGenerator() { // Final selection based on strategy const finalSet = new Set() while(finalSet.size < 6) { - finalSet.add(Math.floor(Math.random() * activeGame.max) + 1) + const randomBuffer = new Uint32Array(1) + window.crypto.getRandomValues(randomBuffer) + const secureRandom = randomBuffer[0] / (0xffffffff + 1) + finalSet.add(Math.floor(secureRandom * activeGame.max) + 1) } setGeneratedSet(Array.from(finalSet).sort((a, b) => a - b))