Here you can find the source of randomInt(final int upToNotInclusive)
public static int randomInt(final int upToNotInclusive)
//package com.java2s; public class Main { public static int randomInt(final int upToNotInclusive) { final double rnd = Math.random() * upToNotInclusive; int ret = (int) Math.floor(rnd); if (ret == upToNotInclusive) { ret = 0;/*ww w .ja v a2 s. c o m*/ } return ret; } }