[Home] >  Random >  Generate a random boolean

Generate a random boolean

JavaScript version

const randomBoolean = () => Math.random() >= 0.5;

TypeScript version

const randomBoolean = (): boolean => Math.random() >= 0.5;