2016-05-27 04:49:38 +02:00
|
|
|
namespace Math {
|
|
|
|
/**
|
|
|
|
* Generates a `true` or `false` value randomly, just like flipping a coin.
|
|
|
|
*/
|
|
|
|
//% blockId=logic_random block="pick random true or false"
|
2019-12-02 05:58:26 +01:00
|
|
|
//% help=math/random-boolean weight=0 color=712672
|
2016-05-27 04:49:38 +02:00
|
|
|
export function randomBoolean(): boolean {
|
2019-12-02 05:58:26 +01:00
|
|
|
return Math.randomRange(0, 1) === 1;
|
2016-05-27 04:49:38 +02:00
|
|
|
}
|
2020-09-08 11:04:25 +02:00
|
|
|
}
|