Correct dice example (#2262)
Changed random(6) to random(5) so the number reflect real dice.
This commit is contained in:
parent
2ae03522eb
commit
e6ecd65ae4
@ -36,14 +36,14 @@ This example shows a number from 1 to 6 when you press the `B` button.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
let dice = Math.randomRange(0, 6) + 1
|
||||
let dice = Math.randomRange(0, 5) + 1
|
||||
basic.showNumber(dice)
|
||||
})
|
||||
```
|
||||
|
||||
## ~hint
|
||||
|
||||
This program adds a `1` to `random(6)` so the numbers on the dice will come out right.
|
||||
This program adds a `1` to `random(5)` so the numbers on the dice will come out right.
|
||||
Otherwise, sometimes they would show a `0`.
|
||||
|
||||
## ~
|
||||
|
Loading…
Reference in New Issue
Block a user