const randomBool = () => Math.random() >= 0.5; randomBool() //true
import java.util.Random; public static boolean Example(){ Random random = new Random(); return random.nextBoolean(); }