Android Random String Create getRandomString(int len)

Here you can find the source of getRandomString(int len)

Description

get Random String

Declaration

public static String getRandomString(int len) 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    public static String getRandomString(int len) {
        String returnStr = "";
        char[] ch = new char[len];
        Random rd = new Random();
        for (int i = 0; i < len; i++) {
            ch[i] = (char) (rd.nextInt(9) + 97);
        }/*from w w w.  ja  v a 2  s.c om*/
        returnStr = new String(ch);
        return returnStr;
    }
}

Related

  1. getRandomStr(int length)
  2. getRandomString(int length)
  3. randomString(int size)
  4. randomIVString()