Java ThreadLocalRandom getRandomStr(int len)

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

Description

get Random Str

License

Open Source License

Declaration

public static String getRandomStr(int len) 

Method Source Code

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

import java.util.concurrent.ThreadLocalRandom;

public class Main {

    public static String getRandomStr(int len) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < len; i++) {
            int num = ThreadLocalRandom.current().nextInt(10);
            sb.append(num);/*w ww  .ja  va 2s. c  o  m*/
        }
        return sb.toString();
    }
}

Related

  1. getRandomInt(int r)
  2. getRandomInteger()
  3. getRandomIntegerElement(List list)
  4. getRandomNumbers(Integer startNumber, Integer endNumber, Integer pageSize, Integer numNumbers)
  5. getRandomPassword()
  6. getRandomString(int length)
  7. getRandomTarget(List targets)
  8. getRandomValue(String prefix, long maxValue)
  9. getTempPersistFileName(String baseFileName)