2016-04-04 21:18:16 -07:00
|
|
|
namespace console {
|
|
|
|
export function log(msg: string) {
|
|
|
|
serial.writeString(msg);
|
|
|
|
serial.writeString("\r\n");
|
|
|
|
}
|
|
|
|
}
|
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"
|
2017-02-28 18:12:46 -08:00
|
|
|
//% help=math/random-boolean
|
2016-05-26 19:49:38 -07:00
|
|
|
export function randomBoolean(): boolean {
|
|
|
|
return Math.random(2) == 0;
|
|
|
|
}
|
|
|
|
}
|