From 46b1144f441130c1379d39c88c1d532d1cf67ec3 Mon Sep 17 00:00:00 2001 From: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:17:07 -0500 Subject: [PATCH] Potential fix for code scanning alert no. 23: Insecure randomness Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- tests/integration/bank.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/bank.spec.ts b/tests/integration/bank.spec.ts index 0029a0e..4ed54f9 100644 --- a/tests/integration/bank.spec.ts +++ b/tests/integration/bank.spec.ts @@ -1,5 +1,5 @@ import * as dgraph from "../../src" - +import * as crypto from "crypto" import { setSchema, setup, wait } from "../helper" const concurrency = 5 @@ -79,8 +79,8 @@ async function runTxn(): Promise { let toUid: string while (true) { - fromUid = uids[Math.floor(Math.random() * uids.length)] - toUid = uids[Math.floor(Math.random() * uids.length)] + fromUid = uids[crypto.randomInt(uids.length)] + toUid = uids[crypto.randomInt(uids.length)] if (fromUid !== toUid) { break