From 3884f8cac60f8998a4f34bad731007eb49bb7d50 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Sat, 21 Apr 2018 10:57:49 -0700 Subject: [PATCH] Better random Boolean --- libs/core/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/helpers.ts b/libs/core/helpers.ts index 0f528076..01513f95 100644 --- a/libs/core/helpers.ts +++ b/libs/core/helpers.ts @@ -12,7 +12,7 @@ namespace Math { //% blockId=logic_random block="pick random true or false" //% help=math/random-boolean weight=0 export function randomBoolean(): boolean { - return Math.random() >= 0.5; + return Math.floor(Math.random() * 2) == 1; } export function randomInt(max: number): number {