Better random Boolean

This commit is contained in:
Sam El-Husseini 2018-04-21 10:57:49 -07:00
parent edb96c87c6
commit 3884f8cac6

View File

@ -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 {