Here you can find the source of getBoolean()
public static boolean getBoolean()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static Random random; public static boolean getBoolean() { if (random == null) init();//from w w w .j a v a2 s . co m return random.nextBoolean(); } public static boolean getBoolean(float chance) { if (random == null) init(); return random.nextFloat() <= chance; } public static synchronized void init() { if (random == null) random = new Random(); } }