Java tutorial
//package com.java2s; import java.util.Random; public class Main { private static Random rnd = new Random(); private static String getRandomNumber(int digCount) { StringBuilder sb = new StringBuilder(digCount); for (int i = 0; i < digCount; i++) { sb.append((rnd.nextInt(10))); } return sb.toString(); } }