Java Random String getRandomStr()

Here you can find the source of getRandomStr()

Description

get Random Str

License

Open Source License

Declaration

protected static String getRandomStr() 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    protected static String getRandomStr() {
        String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 16; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }/*ww w . jav  a 2s  .co m*/
        return sb.toString();
    }
}

Related

  1. getRandomElementOrCompound(String equation)
  2. getRandomFromTier(int tier, String lvlRange)
  3. getRandomNumberString(int length)
  4. getRandomNumberString(int maxValue, int strLen)
  5. getRandomNumberStringBase36(int strLen)
  6. getRandomStr()
  7. getrandomstr()
  8. getRandomStr()
  9. getRandomStr()