Fix randomInt
This commit is contained in:
@ -58,7 +58,7 @@ on the screen.
|
||||
|
||||
```block
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
basic.showNumber(Math.randomInt(7))
|
||||
basic.showNumber(Math.randomRange(0, 7))
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -22,7 +22,7 @@ rock, paper, and scissors are the tools you use to challenge your friends!)
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
tool = Math.randomInt(3)
|
||||
tool = Math.randomRange(0, 3)
|
||||
})
|
||||
```
|
||||
|
||||
@ -36,7 +36,7 @@ check whether ``tool`` is equal to ``0``.
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let tool = Math.randomInt(3)
|
||||
let tool = Math.randomRange(0, 3)
|
||||
if (tool == 0) {
|
||||
}
|
||||
})
|
||||
@ -50,7 +50,7 @@ picture of a piece of paper.
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let tool = Math.randomInt(3)
|
||||
let tool = Math.randomRange(0, 3)
|
||||
if (tool == 0) {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
@ -73,7 +73,7 @@ Click on the gearwheel icon to open up the ``if`` editor; then drag and drop an
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let tool = Math.randomInt(3)
|
||||
let tool = Math.randomRange(0, 3)
|
||||
if (tool == 0) {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
@ -94,7 +94,7 @@ Place a ``||basic:show leds||`` block under the else if and draw a **rock** imag
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let tool = Math.randomInt(3)
|
||||
let tool = Math.randomRange(0, 3)
|
||||
if (tool == 0) {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
@ -125,7 +125,7 @@ That's why you can use an ``else`` instead of an ``else if``.
|
||||
```blocks
|
||||
let tool = 0;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let tool = Math.randomInt(3)
|
||||
let tool = Math.randomRange(0, 3)
|
||||
if (tool == 0) {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
|
Reference in New Issue
Block a user