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