Java Random Number getRandomNum(int len)

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

Description

get Random Num

License

LGPL

Declaration

public static String getRandomNum(int len) 

Method Source Code

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

import java.util.Random;

public class Main {

    public static String getRandomNum(int len) {
        Random random = new Random();
        StringBuffer strNum = new StringBuffer();
        for (int i = 0; i < len; i++) {
            int num = random.nextInt(10);
            strNum.append(num);//from  ww w . j a va2  s  .  c o  m
        }
        return strNum.toString();
    }
}

Related

  1. getRandomNum()
  2. getRandomNum()
  3. getRandomNum()
  4. getRandomNum()
  5. getRandomNum(double pSngBegin, double pSngEnd)
  6. getRandomNum(int pwd_len)
  7. getRandomNumAndLetterAF(int len)
  8. getRandomNumAndStr(int length)
  9. getRandomNumber()