Better random Boolean
This commit is contained in:
parent
edb96c87c6
commit
3884f8cac6
@ -12,7 +12,7 @@ namespace Math {
|
|||||||
//% blockId=logic_random block="pick random true or false"
|
//% blockId=logic_random block="pick random true or false"
|
||||||
//% help=math/random-boolean weight=0
|
//% help=math/random-boolean weight=0
|
||||||
export function randomBoolean(): boolean {
|
export function randomBoolean(): boolean {
|
||||||
return Math.random() >= 0.5;
|
return Math.floor(Math.random() * 2) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function randomInt(max: number): number {
|
export function randomInt(max: number): number {
|
||||||
|
Loading…
Reference in New Issue
Block a user