Java Random Int randomStr(int length)

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

Description

random Str

License

Apache License

Declaration

public static String randomStr(int length) 

Method Source Code

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

public class Main {
    private final static String ALPHABET = "asdfghjklpoiuytrewqzxcvbnm=-0987654321_+ASDFGHJKLPOIUYTREWQZXCVBNM";

    public static String randomStr(int length) {
        return random(length, ALPHABET);
    }/*from w  w w . j a  va  2  s .co  m*/

    private static String random(int length, String data) {
        String str = "";
        int len = data.length();
        while (length > 0) {
            length--;
            str += data.charAt((int) (Math.random() * len));
        }
        return str;
    }
}

Related

  1. randomPointsFromUnitSquare(int n)
  2. randomQuickSort(int[] array)
  3. randomRange(int min, int max)
  4. randomSize(int maxValue)
  5. randomSMSCode(int length)
  6. randomStr(int length, String charSet)
  7. randomString(int count)
  8. randomString(int length)
  9. randomString(int length)