Java tutorial
import java.util.Random; public class Main { public static void main(String[] argv) throws Exception { Random rand = new Random(); boolean b = rand.nextBoolean(); long l = rand.nextLong(); float f = rand.nextFloat(); // 0.0 <= f < 1.0 double d = rand.nextDouble(); // 0.0 <= d < 1.0 } }