Generates a random alphanumeric string of the given length.

@param length the length
@return a random string
333583
public static String randomAlphaNumString(int length) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < length; i++) {
      sb.append(ALPHANUM.charAt(RANDOM.nextInt(ALPHANUM.length())));
    }
    return sb.toString();
  }
323351
public static String generatePassword(int length)
  {
    Params.strictPositive(length, "Password length");
    StringBuilder password = new StringBuilder(length);
    Random random = new Random();

    for(int i = 0; i < length; i++) {
      String charCategory = PASSWORD_DICTIONARY[random.nextInt(PASSWORD_DICTIONARY.length)];
      int position = random.nextInt(charCategory.length());
      password.append(charCategory.charAt(position));
    }
    return new String(password);
  }
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;
}
356251
public static String getRandomString(final int size, final int start, final int length) {
		final StringBuilder buff = new StringBuilder(size);

		for (int i = 0; i < size; i++) {
			buff.append((char) (RAN.nextInt(length) + start));
		}
		return buff.toString();
	}
660830
public static String randomString(int length, @NonNull CharMatcher validChar) {
      return randomString(length, 0, Integer.MAX_VALUE, validChar);
   }
1010726
public static String generateRandomKey (Random rand, int length)
    {
        int numKeyChars = KEY_CHARS.length();
        StringBuilder buf = new StringBuilder();
        for (int ii = 0; ii < length; ii++) {
            buf.append(KEY_CHARS.charAt(rand.nextInt(numKeyChars)));
        }
        return buf.toString();
    }
993241
public static String getRandomString(final int stringLength) {

    StringBuilder stringBuilder = getStringBuild();
    for (int i = 0; i < stringLength; i++) {
      stringBuilder.append(getRandomAlphabetic());
    }
    return stringBuilder.toString();
  }
184901
public static function randomString(int $length): string
    {
        try {
            $rand = bin2hex(random_bytes($length));
            // bytes_length = length * 2
            $rand = substr($rand, 0, $length);
        } catch (\Exception $ce) {
            $rand = Str::randomLatinNumeric($length);
        }

        return $rand;
    }
654553
public static String captchaNumber(int length) {
        StringBuilder sb   = new StringBuilder();
        Random        rand = new Random();
        for (int i = 0; i < length; i++) {
            sb.append(rand.nextInt(10));
        }
        return sb.toString();
    }
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);
    }
488851
def random(self, length=22):
        
        random_num = int(binascii.b2a_hex(os.urandom(length)), 16)
        return self._num_to_string(random_num, pad_to_length=length)[:length]
1263558
function randomString(length, chars) {
  length = length || 8;
  chars = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  var result = '';
  for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
  return result;
}
177621
public static String random(int count, RandomType randomType) {
		if (count == 0) return "";
		if (count < 0) {
			throw new IllegalArgumentException("Requested random string length " + count + " is less than 0.");
		}
		char[] buffer = new char[count];
		for (int i = 0; i < count; i++) {
			if (randomType.equals(RandomType.INT)) {
				buffer[i] = _INT.charAt(RANDOM.nextInt(_INT.length()));
			} else if (randomType.equals(RandomType.STRING)) {
				buffer[i] = _STR.charAt(RANDOM.nextInt(_STR.length()));
			}else {
				buffer[i] = _ALL.charAt(RANDOM.nextInt(_ALL.length()));
			}
		}
		return new String(buffer);
	}
499298
public static String getRandomPasswordString(final int stringLength) {

    StringBuilder stringBuilder = getStringBuild();
    for (int i = 0; i < stringLength; i++) {
      stringBuilder.append(getRandomPasswordChar());
    }
    return stringBuilder.toString();
  }
1177862
public String readStringFix(final int length) {
        byte[] result = new byte[length];
        byteBuf.readBytes(result);
        return new String(result);
    }
1199504
public static String randomNumber(Long length, boolean padding, TestContext context) {
        return new RandomNumberFunction().execute(Arrays.asList(String.valueOf(length), String.valueOf(padding)), context);
    }
829385
public function generateRandomString(
        int $length = 10,
        string $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#%^*()-_[]{}<>=/|$'
    ): string {
        $randomStr = '';
        for ($i = 0; $i < $length; $i++) {
            $randomCharIndex = random_int(0, \strlen($chars) - 1);
            $randomStr .= $chars[$randomCharIndex];
        }

        return $randomStr;
    }