Change docs to randomInt
This commit is contained in:
@ -21,7 +21,7 @@ We need to show a random value from 1 to 6 on our dice. So let's make a local va
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
})
|
||||
```
|
||||
|
||||
@ -30,7 +30,7 @@ We need a condition for if **roll** is 5. We will show a `6` if **roll** is 5 be
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(6);
|
||||
let roll = Math.randomInt(6);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -48,7 +48,7 @@ Let's use an `else if` condition for if **roll** is 4. If **roll** is 4 we can s
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, ()=> {
|
||||
let roll = Math.random(6);
|
||||
let roll = Math.randomInt(6);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -75,7 +75,7 @@ Now we need to repeat the same steps for if **roll** is 3. If **roll** is 3 we w
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(6);
|
||||
let roll = Math.randomInt(6);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -108,7 +108,7 @@ Let's also repeat these steps to show the 3, 2, and 1 on the dice. We are almost
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(6);
|
||||
let roll = Math.randomInt(6);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
|
@ -8,7 +8,7 @@ Complete the following [guided tutorial](/lessons/dice-roll/activity), your code
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(6);
|
||||
let roll = Math.randomInt(6);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -67,7 +67,7 @@ Modify the line of code with `pick random` so that only number 1-4 can appear on
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(4);
|
||||
let roll = Math.randomInt(4);
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -125,7 +125,7 @@ Let's make a trick dice! Modify the line of code with `pick random` so that only
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let roll = Math.random(4) + 2;
|
||||
let roll = Math.randomInt(4) + 2;
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
|
@ -9,7 +9,7 @@ These are the answers to the [dice roll quiz](/lessons/dice-roll/quiz).
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
```
|
||||
|
||||
## 2. If the variable "roll" equals 5, write the code that will plot the image below
|
||||
@ -19,7 +19,7 @@ let roll = Math.random(6)
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -39,7 +39,7 @@ if (roll == 5) {
|
||||
|
||||
```blocks
|
||||
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
if (roll == 5) {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
@ -68,7 +68,7 @@ Note: students are only required to write the bottom half of this answer, starti
|
||||
<br />
|
||||
|
||||
```blocks
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
if (roll == 4) {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
@ -97,7 +97,7 @@ Note: students are only required to write the bottom half of this answer, starti
|
||||
<br />
|
||||
|
||||
```blocks
|
||||
let roll = Math.random(6)
|
||||
let roll = Math.randomInt(6)
|
||||
if (roll == 3) {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
|
Reference in New Issue
Block a user