Here you can find the source of getBoolean(double probability)
public static boolean getBoolean(double probability)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static final Random random = new Random(); public static boolean getBoolean(double probability) { return getDouble() < probability; }// w w w . ja v a 2 s . c o m public static double getDouble() { return random.nextDouble(); } public static double getDouble(double max) { return getDouble() * max; } public static double getDouble(double min, double max) { return max > min ? min + getDouble(max - min) : min; } }