Generates a random number of the provided length

@param {int} _length
@api public
491671
function random(_length) {
    
    var string_length = _length;
    if(string_length < 0)
    	string_length = 1;
    	
    var chars = "0123456789";
    
    var num = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        num += chars.substring(rnum,rnum+1);
    }
    return num*1;
}
211518
function random_bytes(count) {
        var bs = new Uint8Array(count);
        if (typeof (window.crypto) !== "undefined") {
          if (typeof (window.crypto.getRandomValues) !== "undefined") {
            window.crypto.getRandomValues(bs);
            return bs;
          }
        }
        if (typeof (window.msCrypto) !== "undefined") {
          if (typeof (window.msCrypto.getRandomValues) !== "undefined") {
            window.msCrypto.getRandomValues(bs);
            return bs;
          }
        }
        throw {
          message: "No suitable random number generator found!"
        };
      }
1294007
public static function random($length) {
        $res = '';
        for ($i = 0; $i < $length; $i++) {
            $res .= chr(mt_rand(33, 126));
        }
        return $res;
    }
1280539
function randstr(options) {
    var opt = _validateOptions(options);
    var from, to;
    if (Array.isArray(opt.length)) {
        _a = opt.length, from = _a[0], to = _a[1];
    }
    else {
        from = to = opt.length;
    }
    var str = '';
    if (0 === to) {
        return str;
    }
    var charsIsString = 'string' === typeof opt.chars;
    var charsLastIndex = charsIsString ? opt.chars.length - 1 : 0;
    var includeControlChars = true === opt.includeControlChars;
    var hasAcceptableFunc = 'function' === typeof opt.acceptable;
    var hasReplacer = 'function' === typeof opt.replacer;
    var max = _randomIntBetween(opt.random, from, to);
    // console.log( 'max', max, 'from', from, 'to', to );
    for (var i = 0, len = 0, charCode = void 0, chr = void 0; i < max && len < max; ++i) {
        if (charsIsString) {
            var index = _randomIntBetween(opt.random, 0, charsLastIndex);
            charCode = opt.chars.charCodeAt(index);
        }
        else {
            charCode = _randomIntBetween(opt.random, opt.chars[0], opt.chars[1]);
        }
        // Non printable?
        if (!includeControlChars && _isControlChar(charCode)) {
            // console.log( 'NOT PRINTABLE!');
            --i; // back to try again
            continue;
        }
        chr = String.fromCharCode(charCode);
        // console.log( 'charCode', charCode, 'char', chr );
        if (hasAcceptableFunc && !opt.acceptable.call(null, chr)) {
            --i; // back to try again
            continue;
        }
        if (hasReplacer) {
            chr = opt.replacer.call(null, chr);
            // console.log( 'char after', chr );
            // Their combined length pass the limit?
            if ((len + chr.length) > max) {
                // console.log( 'greater than max!', 'i', i, 'max', max, 'str', len, 'chr', chr.length );
                --i; // back to try again
                continue;
            }
        }
        str += chr;
        len = str.length;
    }
    return str;
    var _a;
}
1199504
public static String randomNumber(Long length, boolean padding, TestContext context) {
        return new RandomNumberFunction().execute(Arrays.asList(String.valueOf(length), String.valueOf(padding)), context);
    }
995263
public static function random_string($length) {
        $key = '';
        $keys = array_merge(range(0, 9), range('a', 'z'));

        for ($i = 0; $i < $length; $i++) {
            $key .= $keys[array_rand($keys)];
        }

        return $key;
    }
1232624
public static function GenerateRandomString(int $length = 20)
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $charactersLength = strlen($characters);
        $randomString = '';
        for ($i = 0; $i < $length; $i++) {
            $randomString .= $characters[rand(0, $charactersLength - 1)];
        }
        return $randomString;
    }
515787
function generateAnotherInt(err, int) {
                  if (err) return callback(err)

                  if (ints.indexOf(int) > -1) {
                    // we already found that random number, run callback to make the loop again
                    callback()
                  } else {
                    // replace the integer in that position and run the loop again
                    ints[position] = int
                    callback()
                  }
                }
1149636
public static String generateDigitsString(int length) {
        StringBuffer buf = new StringBuffer(length);
        SecureRandom rand = new SecureRandom();
        for (int i = 0; i < length; i++) {
            buf.append(rand.nextInt(digits.length));
        }
        return buf.toString();
    }
239685
function makeId(length = RANDOM_CHARACTER_LENGTH) {
    let text = "";
    for (let i = 0; i < length; i++) {
        text += RANDOM_CHARACTER_SOURCE.charAt(Math.floor(Math.random() * RANDOM_CHARACTER_SOURCE.length));
    }

    return text;
}
406662
public function randomNumbers($length = 6)
    {
        $nums = '0123456789';

        $out = $nums[mt_rand(1, strlen($nums)-1)];

        for ($p = 0; $p < $length-1; $p++) {
            $out .= $nums[mt_rand(0, strlen($nums)-1)];
        }

        return $out;
    }
447686
def generate_random_token(length=32):
    
    chars = (string.ascii_lowercase + string.ascii_uppercase + string.digits)
    return ''.join(random.choice(chars) for _ in range(length))
432748
public static function randNumbers($length = 6)
    {
        if ($length < 0) $length = 1;
        if ($length > 8) $length = 8;
        $start = pow(10, $length - 1);
        return mt_rand($start, ($start * 10) - 1);
    }
593457
function(length) {
      var bytes, hex;
      if (length == null) {
        length = 32;
      }
      length /= 2;
      bytes = this.randomBytes(length);
      return hex = this.toHex(bytes).toUpperCase();
    }
873775
def random_string(len)
      rand_max = RAND_CHARS.bytesize
      ret = ""
      len.times{ ret << RAND_CHARS[rand(rand_max)] }
      ret
    end
129277
public String generateRandomToken(int length) {
        final char[] token = new char[length];

        for (int i = 0; i < length; i++) {
            final int tokenIndex = random.nextInt(this.tokenChars.length);
            token[i] = tokenChars[tokenIndex];
        }

        return new String(token);
    }
1220481
function randomNumber() {
  var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;

  return Math.floor(Math.random() * (max - min + 1)) + min;
}