This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Diamond's profile picture

Math.random. How To Make It So If It Chooses A Certain Number, It Executes A Function?

Started by Diamond, 15 October 2013 - 05:07 AM
Diamond #1
Posted 15 October 2013 - 07:07 AM
I want to make an more advanced "Hello World".


For example, it generates a random number 1-10. If the number is 7, it says "Hi world". If it's not 7, it says "Hello World". How would I do this?
Wojbie #2
Posted 15 October 2013 - 07:13 AM
simple
if math.random(1,10) == 7 then else end 
will give you what you need
Diamond #3
Posted 16 October 2013 - 06:14 AM
simple
if math.random(1,10) == 7 then else end 
will give you what you need
thx