Java Random String getRandomStr(int qty)

Here you can find the source of getRandomStr(int qty)

Description

get Random Str

License

Open Source License

Declaration

public static String getRandomStr(int qty) 

Method Source Code


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

import java.util.Random;

public class Main {
    public static String getRandomStr(int qty) {
        String d = "abcdfghijklmnopqrtuvwxyz";
        Random rand = new Random();
        int i = 0;
        int n = 0;
        String f = "";
        while (i < qty) {
            n = rand.nextInt(24 - 0 + 1) + 0;
            f += d.substring(n, n + 1);//from  w  w w .j  a v  a 2s  .  c  o  m
            i++;
        }
        return f;
    }
}

Related

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