Java Random String getRandomString()

Here you can find the source of getRandomString()

Description

get Random String

License

Open Source License

Declaration

private static String getRandomString() 

Method Source Code

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

import java.util.Random;

public class Main {
    private static final Random random = new Random();
    private static final char[] chars = "abcdefghijklmnopqrstwyxz".toCharArray();

    private static String getRandomString() {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 10; i++) {
            builder.append(chars[random.nextInt(chars.length)]);
        }//from  w w w  .j av a 2 s .  c om
        return builder.toString();
    }
}

Related

  1. getRandomStr(int qty)
  2. getRandomStr(String src)
  3. getRandomString()
  4. getRandomString()
  5. getRandomString()
  6. getRandomString()
  7. getRandomString()
  8. getRandomString()
  9. getRandomString()