Java Random String getRandomString()

Here you can find the source of getRandomString()

Description

get Random String

License

Open Source License

Declaration

public static String getRandomString() 

Method Source Code

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

import java.util.Random;

public class Main {
    public static String getRandomString() {
        Random random = new Random();
        int randomName = random.nextInt(99999999);

        return "" + randomName;
    }//from  w  w w  .  j  av a  2 s  .  c  o  m

    public static String getRandomString(int len) {
        int seed = 10 ^ len - 1;

        Random random = new Random();
        int randomName = random.nextInt(seed);

        return "" + randomName;
    }
}

Related

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