Java Random String generateRandomString()

Here you can find the source of generateRandomString()

Description

generate Random String

License

Apache License

Declaration

public static String generateRandomString() 

Method Source Code

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

import java.util.Random;

public class Main {
    public static String generateRandomString() {
        Random rnd = new Random();
        if (rnd.nextInt(3) == 0) {
            return "";
        } else {/*from   w w  w.java2 s  .  c  om*/
            return "test" + rnd.nextInt();
        }
    }
}

Related

  1. generateRandomCharacters(int N)
  2. generateRandomCode()
  3. generateRandomSentence()
  4. generateRandomStr(final int length)
  5. generateRandomStr(int length)
  6. generateRandomString()
  7. generateRandomString()
  8. generateRandomString()
  9. generateRandomString()