Yes, Rnd() starts at 0
So, to simulate a coin toss:
TOSS=Rnd(1)
If TOSS=0
Print "HEADS!"
Else
Print "TAILS!"
EndIf
Wait Key
If you do want a value to start at 1, simply do this:
ROLL=Rnd(5)+1 : Rem Simulate the values of a standard 6 sided dice (1 to 6)
Example:
Randomize Timer() : Rem without this, you'll get same values rolled everytime you run the prog.
CLS 0 : Set Cursor 0,0 : Ink RGB(127,127,255),RGB(0,0,0)
Print "Press a key to roll the dice (Get a 6 to continue)"
Print
ATTEMPTS=0
Repeat
Wait Key
ROLL=Rnd(5)+1 : Rem gives a value between 1 and 6
Print "You roll the dice and score ";ROLL
Inc ATTEMPTS
Until ROLL=6
Print
Ink RGB(255,255,255),RGB(0,0,0)
If ATTEMPTS>6
Print "Phew! At last"
Else
Print "Good!"
EndIf
Wait 2000
CLS 0 : Set Cursor 0,0 :Ink RGB(127,191,255),RGB(0,0,0)
Print "Now roll 3 dice individually (Get greater than 12 to continue)"
Print
ATTEMPTS=0
Repeat
Wait Key
D1=Rnd(5)+1
D2=Rnd(5)+1
D3=Rnd(5)+1
ROLL=D1+D2+D3
Print "You roll 3 die: a ";D1;", a ";D2;" and a ";D3;" totalling ";(D1+D2+D3)
Inc ATTEMPTS
Until (D1+D2+D3)>12
Print
Ink RGB(255,255,255),RGB(0,0,0)
IF ATTEMPTS>3
Print "Sheesh...Take your time, why don't you?!"
Else
Print "{Yawn}...Wonderful!"
EndIf
Wait 2000
CLS 0 : Set Cursor 0,0 : Ink RGB(191,191,255),RGB(0,0,0)
Print "Now roll 3 dice again using a different formulae"
Print
ATTEMPTS=0
Repeat
Wait Key
ROLL=Rnd(18)+3
Print "You roll 3 die and score a total of ";ROLL
Inc ATTEMPTS
Until ROLL>12
Print
Ink RGB(255,255,255),RGB(0,0,0)
If ATTEMPTS>2
Print "And you'd rather be doing this than spending time with your other half, right?"
Else
Print "Excellent! Now go away and roll some real die instead!"
EndIf
Wait 3000
End