X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils.ts;h=6178d8f116988475eca3e3fc8ac96a9260c563b7;hb=970b38d6f87c7d0d29498f13af934c8ff6d472f5;hp=f1c0d923f2d3b15ed12ff06422996b0d5c13de19;hpb=147be6fe188035c47548d07ef1f7cd884bd85f60;p=poolifier.git diff --git a/src/utils.ts b/src/utils.ts index f1c0d923..6178d8f1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,5 @@ import * as os from 'node:os' +import { getRandomValues } from 'node:crypto' import type { MeasurementStatisticsRequirements, WorkerChoiceStrategyOptions @@ -252,6 +253,6 @@ export const once = ( * * @returns A number in the [0,1[ range */ -const secureRandom = (): number => { - return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 +export const secureRandom = (): number => { + return getRandomValues(new Uint32Array(1))[0] / 0x100000000 }