fix: workaround node 16 issue with crypto named export
[poolifier.git] / src / utils.ts
index f1c0d923f2d3b15ed12ff06422996b0d5c13de19..33ec019db92c46688615be01bd8a59573c0b2457 100644 (file)
@@ -1,4 +1,5 @@
 import * as os from 'node:os'
+import * as crypto 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 => {
+export const secureRandom = (): number => {
   return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000
 }