Here you can find the source of getRandomStr(String src)
private static final String getRandomStr(String src)
//package com.java2s; import java.util.Random; public class Main { private static final String getRandomStr(String src) { if (null == src || "".equals(src)) { return ""; }/*from w w w. jav a 2 s. c o m*/ Random random = new Random(); return String.valueOf(src.charAt(random.nextInt(src.length()))); } }