Here you can find the source of randomDigit()
public static char randomDigit()
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static final Random gRandomizer = new Random(System.currentTimeMillis()); /**//from w w w. j ava 2 s . c o m * choose a random digit * @return '0' ...'9' */ public static char randomDigit() { return ((char) ('0' + randomInt(10))); } /**{ method @name randomElement @function - choose an element of an array at random @param in - choices - non-null non-empty @return - one choice }*/ public static int randomInt(int in) { if (in <= 1) { if (in == 1) return (0); throw new IllegalArgumentException("randomInt must take a number > 1"); } int test = gRandomizer.nextInt(in); if (test < 0) test = -test; return (test); } }