Fix randomInt

This commit is contained in:
Sam El-Husseini
2018-06-01 11:42:38 -07:00
parent b5814709f8
commit 6f148c14e0
61 changed files with 152 additions and 158 deletions

View File

@ -59,7 +59,7 @@ input.onButtonPressed(Button.B, () => {
basic.showNumber(p2)
})
input.onGesture(Gesture.Shake, () => {
if (Math.randomInt(p1 + p2 - 1 + 1) + 1 <= p1) {
if (Math.randomRange(0, p1 + p2 - 1 + 1) + 1 <= p1) {
basic.showString("A")
} else {
basic.showString("B")
@ -118,10 +118,10 @@ let previous_roll = 0
input.onButtonPressed(Button.AB, () => {
previous_roll = 0
if (4 <= previous_roll) {
yes_or_no = Math.randomInt(8)
yes_or_no = Math.randomRange(0, 8)
}
if (4 > previous_roll) {
yes_or_no = Math.randomInt(5)
yes_or_no = Math.randomRange(0, 5)
}
if (2 < yes_or_no) {
basic.showString("YES")
@ -132,7 +132,7 @@ input.onButtonPressed(Button.AB, () => {
}
})
input.onGesture(Gesture.Shake, () => {
current_roll = Math.randomInt(6)
current_roll = Math.randomRange(0, 6)
basic.showNumber(current_roll + 1)
basic.pause(5000)
basic.clearScreen()