Here you can find the source of getRandomNumber(int length)
Parameter | Description |
---|---|
length | a parameter |
public static String getRandomNumber(int length)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { /**//from w w w.j ava 2 s . c om * @param length * @return */ public static String getRandomNumber(int length) { String result = ""; Random r = new Random(); while (0 < length) { length -= 1; result += r.nextInt(9); } return result; } }