Android Random String Create genRandomString(int pLength)

Here you can find the source of genRandomString(int pLength)

Description

gen Random String

License

Open Source License

Declaration

private static String genRandomString(int pLength) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    private static String genRandomString(int pLength) {
        Random r = new Random();
        String letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < pLength; i++) {
            sb.append(letter.charAt(r.nextInt(1000000) % (letter.length())));
        }//  ww  w.  j a  va2 s  .co m
        return sb.toString();
    }
}

Related

  1. getRandomString(int length)
  2. randomString(int size)
  3. randomIVString()
  4. getRandomString()
  5. getRandomPwd()
  6. generateRandom()
  7. randomAlphaNumeric(int length)