Here you can find the source of createNewPin()
public static int createNewPin()
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ThreadLocalRandom; public class Main { public static int createNewPin() { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive int randomNum = ThreadLocalRandom.current().nextInt(1, 10000); return randomNum; }/* ww w . j a v a 2 s . c o m*/ }