Here you can find the source of createRandom(int number)
public static String createRandom(int number)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ThreadLocalRandom; public class Main { public static String createRandom(int number) { long min = (long) Math.pow(10, number - 1) + 1; long max = (long) Math.pow(10, number) - 1; long result = (long) ThreadLocalRandom.current().nextDouble(min, max); return result + ""; }/*w ww .java 2s .c o m*/ }