Java Random String getRandomStr(int n)

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

Description

get Random Str

License

Apache License

Declaration

private static String getRandomStr(int n) 

Method Source Code

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

import java.util.Random;

public class Main {
    private static String getRandomStr(int n) {
        String s = "";
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            s = s + random.nextInt(10);/*  w ww  . ja v a  2  s  . co  m*/
        }
        return s;
    }
}

Related

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