pxt-calliope/libs/core/helpers.ts

10 lines
317 B
TypeScript
Raw Normal View History

2016-05-26 19:49:38 -07:00
namespace Math {
/**
* Generates a `true` or `false` value randomly, just like flipping a coin.
*/
//% blockId=logic_random block="pick random true or false"
//% help=math/random-boolean weight=0
2016-05-26 19:49:38 -07:00
export function randomBoolean(): boolean {
return Math.randomRange(0, 1) === 1;
}
2016-05-26 19:49:38 -07:00
}