Method to randomize the DigitWord to a given length; for example obj.random(length=4) would
        produce a DigitWord containing of four random Digits or HexDigits. The type of digit created
        is set by the wordtype.
325964
def random(self, length=4):
        """"""
        if not isinstance(length, int):
            raise TypeError('DigitWord can only be randomized by an integer length')

        if self.wordtype == DigitWord.DIGIT:
            self._word = [Digit(random.randint(0, 9)) for i in range(0, length)]
        elif self.wordtype == DigitWord.HEXDIGIT:
            self._word = [HexDigit(str(hex(random.randint(0, 15))).replace('0x',''))
                          for i in range(0, length)]
        else:
            raise TypeError('wordtype is invalid.')
1189629
public static String randomNumberString(int length) {
        char[] chars = "0123456789".toCharArray();
        return RandomStringUtils.random(length, 0, 9, false, false, chars);
    }
442149
def rand_str(allowed, length):
    
    if (not isinstance(length, int)) or (length <= 0):
        raise Exception("length parameter has to be an integer greater than 0!")
    
    res = list()
    for _ in range(length):
        res.append(random.choice(allowed))
    return "".join(res)
169922
def generate_random_string(length=8):
    
    char_set = string.ascii_uppercase + string.digits
    return ''.join(random.sample(char_set * (length - 1), length))
1092872
def make_password(length, chars=string.letters + string.digits + '#$%&!'):
    
    return get_random_string(length, chars)
1022676
private static final String randomString(final Random random) {
		final byte[] bytes = new byte[RANDOM_BYTES_LENGTH];
		random.nextBytes(bytes);
		return StringUtils.byteToHexString(bytes);
	}
590913
def random_string(string_length=10):
    """"""
    random = str(uuid.uuid4())  # Convert UUID format to a Python string.
    random = random.upper()  # Make all characters uppercase.
    random = random.replace("-", "")  # Remove the UUID '-'.
    return random[0:string_length]
558987
function generateRandomId (length) {
  var str = ''
  length = length || 6
  while (str.length < length) {
    str += (((1 + Math.random()) * 0x10000) | 0).toString(16)
  }
  return str.substring(str.length - length, str.length)
}
1070939
def random_hex(length):
    """"""
    return escape.to_unicode(binascii.hexlify(os.urandom(length))[length:])
552671
def random(self, n: Optional[int] = None) -> Union[List[float], float]:
        
        randoms = []
        n_or_default = 1 if n is None else n

        for _ in range(n_or_default):
            number_of_digits = _RandintsToFloatOptions.RANDINTS_NUMBER_OF_DIGITS.value
            max_int = int('9' * number_of_digits)

            randints = self.randint(0, max_int, _RandintsToFloatOptions.RANDINTS_QUANTITY.value)
            zero_padded_ints = (str(randint).zfill(number_of_digits) for randint in randints)
            random = float(f"0.{''.join(zero_padded_ints)}")
            randoms.append(random)

        return randoms if n else randoms[0]
554413
function random(len) {
    if (subtle) {
        return safeRandom(len);
    } else if (nodeCrypto) {
        return new Uint8Array(nodeCrypto.randomBytes(len));
    } else {
        throw new KdbxError(Consts.ErrorCodes.NotImplemented, 'Random not implemented');
    }
}
273942
function randomString(length) {
  var bits = 36,
      tmp,
      out = "";
  while (out.length < length) {
    tmp = Math.random().toString(bits).slice(2);
    out += tmp.slice(0, Math.min(tmp.length, (length - out.length)));
  }
  return out.toUpperCase();
}
752737
function generate(length) {
    var len = length - 1;
    var ary = new Array(len);
    for (var i = 0; i < len; i++) {
      ary.push(Math.floor(Math.random() * 10));
    }
    var num = ary.join('');
    return num + '' + checkSum(num);
  }
110515
void appendHex( int value, int digits ) {
        if( digits > 1 ) {
            appendHex( value >>> 4, digits-1 );
        }
        output.append( DIGITS[ value & 0xF ] );
    }
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);
    }
949620
def random_string(**kwargs):
    
    n = kwargs.get('length', 10)
    pool = kwargs.get('pool') or string.digits + string.ascii_lowercase
    return ''.join(random.SystemRandom().choice(pool) for _ in range(n))
319800
def random_id(length):
    """"""

    def char():
        """Generate single random char"""

        return random.choice(string.ascii_letters + string.digits)

    return "".join(char() for _ in range(length))