Java Random String getRandomStr(String src)

Here you can find the source of getRandomStr(String src)

Description

get Random Str

License

Open Source License

Declaration

private static final String getRandomStr(String src) 

Method Source Code


//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())));
    }
}

Related

  1. getRandomStr(int length)
  2. GetRandomStr(int length)
  3. getRandomStr(int length)
  4. getRandomStr(int n)
  5. getRandomStr(int qty)
  6. getRandomString()
  7. getRandomString()
  8. getRandomString()
  9. getRandomString()