We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 833a662 commit 9829236Copy full SHA for 9829236
test/utils.js
@@ -1,15 +1,19 @@
1
'use strict';
2
3
+const crypto = require('crypto');
4
+
5
function getRandomString(text){
- return text + Math.floor((Math.random() * 100000) + 1);
6
+ const randomInt = crypto.randomBytes(4).readUInt32BE(0) % 100000 + 1;
7
+ return text + randomInt;
8
}
9
10
function getRandomInt(){
- return Math.floor((Math.random() * 100000) + 1);
11
+ return crypto.randomBytes(4).readUInt32BE(0) % 100000 + 1;
12
13
14
function getRandomAmount(){
- return ((Math.random() * 1000) + 1).toFixed(2);
15
+ const randomFloat = crypto.randomBytes(4).readUInt32BE(0) / 0xFFFFFFFF;
16
+ return ((randomFloat * 1000) + 1).toFixed(2);
17
18
19
function getDate(){
0 commit comments