![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mets.corals.io/wp-content/metras.v32.1/node_modules/sockjs-client/lib/utils/ |
'use strict'; /* global crypto:true */ var crypto = require('crypto'); // This string has length 32, a power of 2, so the modulus doesn't introduce a // bias. var _randomStringChars = 'abcdefghijklmnopqrstuvwxyz012345'; module.exports = { string: function(length) { var max = _randomStringChars.length; var bytes = crypto.randomBytes(length); var ret = []; for (var i = 0; i < length; i++) { ret.push(_randomStringChars.substr(bytes[i] % max, 1)); } return ret.join(''); } , number: function(max) { return Math.floor(Math.random() * max); } , numberString: function(max) { var t = ('' + (max - 1)).length; var p = new Array(t + 1).join('0'); return (p + this.number(max)).slice(-t); } };