diff --git a/docs/examples/gameofLife.md b/docs/examples/gameofLife.md index 5e8f23fc..79fe3974 100644 --- a/docs/examples/gameofLife.md +++ b/docs/examples/gameofLife.md @@ -119,10 +119,10 @@ function gameOfLife() { count++; } - // Toggle live\dead cells based on the count. + // Toggle live / dead cells based on the neighbour count. // Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. // Any live cell with two or three live neighbours lives on to the next generation. - // Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction + // Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. // Any live cell with more than three live neighbours dies, as if by overpopulation. switch (count) { case 0: setState(result, x, y, false); break; diff --git a/libs/core/helpers.ts b/libs/core/helpers.ts index 8c18311b..36cbf662 100644 --- a/libs/core/helpers.ts +++ b/libs/core/helpers.ts @@ -12,7 +12,6 @@ namespace Math { //% blockId=logic_random block="pick random true or false" //% help=math/random-boolean weight=0 export function randomBoolean(): boolean { - const v = Math.randomRange(0, 1) * 2; - return 1 == Math.floor(v); + return Math.randomRange(0, 1) === 1; } } \ No newline at end of file