Java Random Int randomString(int length)

Here you can find the source of randomString(int length)

Description

random String

License

LGPL

Declaration

private static String randomString(int length) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    private static String randomString(int length) {
        char[] guts = new char[length];
        for (int i = 0; i < length; i++) {
            guts[i] = Character.toChars(65 + (int) (Math.random() * 26))[0];
        }//from  ww  w .  j a v  a 2 s .  c o  m

        return String.valueOf(guts);
    }
}

Related

  1. randomSMSCode(int length)
  2. randomStr(int length)
  3. randomStr(int length, String charSet)
  4. randomString(int count)
  5. randomString(int length)
  6. randomString(int length)
  7. randomString(int length)
  8. randomString(int min, int max)
  9. randomString(int numChar)