Java Random String generateRandom(Integer digits)

Here you can find the source of generateRandom(Integer digits)

Description

generate Random

License

Apache License

Declaration

public static String generateRandom(Integer digits) 

Method Source Code

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

public class Main {
    public static String generateRandom(Integer digits) {
        String s = "";
        for (int i = 0; i < digits.intValue(); i++) {
            s = s + "0";
        }/* w w  w .  j av a2s .c om*/
        int multiplier = Integer.valueOf(1 + s).intValue();
        int temp = (int) (Math.random() * multiplier);
        s = String.valueOf(temp);
        return s;
    }
}

Related

  1. createRandomString()
  2. createRandomString(final int size)
  3. createRandomString(int length)
  4. createRandomWord(boolean startWithCapital)
  5. generateRandom(int num)
  6. generateRandomChain(int length)
  7. generateRandomCharacters(int N)
  8. generateRandomCode()
  9. generateRandomSentence()