diff --git a/libs/core/helpers.ts b/libs/core/helpers.ts index 8e06cca7..8c18311b 100644 --- a/libs/core/helpers.ts +++ b/libs/core/helpers.ts @@ -12,6 +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.floor(Math.randomRange(0, 1) * 2) == 1; + const v = Math.randomRange(0, 1) * 2; + return 1 == Math.floor(v); } } \ No newline at end of file