Bump eslint-define-config from 1.14.0 to 1.15.0
[benchmarks-js.git] / benchmark-utils.js
index 83d17ca7a7c4bb461d21dc4c994bc4e53b380ee4..e39708b7cf3cfe1cf18b92e25bd1994567f01e26 100644 (file)
@@ -9,6 +9,15 @@ function secureRandom () {
   return crypto.randomBytes(4).readUInt32LE() / 0x100000000
 }
 
+/**
+ *  Generate a cryptographically secure random number in the [0,1[ range
+ *
+ * @returns
+ */
+function secureRandomWithRandomValues () {
+  return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000
+}
+
 /**
  * @param max
  * @param min
@@ -95,5 +104,6 @@ module.exports = {
   generateRandomNumberArray,
   generateRandomObject,
   sleep,
-  secureRandom
+  secureRandom,
+  secureRandomWithRandomValues
 }