Now you don't have to put it into a method since it's static you can just call it with. Which means you can accomplish having the computer randomly pick as well as the random pick of coins to bet by the computer, and hey, even randomly pick what the computer is going to do with just 1 math.random. BUT wait, 0, 1 can also be used to represent the coins that were bet. So it will only randomly pick a number between a certain range.
So you will need to look up the docs cause I wont tell it directly to you, but you can pass in args for a range into the math.random. Ok, so you will need 1 method that picks a random number between a range. It's static because it has no instance variables and does the same thing no matter what you give it and thus no reason to instantiate it. So you will need a counter, that counts to 3 and on the third one resets back to zero and calls this static math.random() method.
On the third try, the computer at random picks. If you have any questions on this stuff I would be happy to help you better understand the pieces, but I don't wanna right it out for you lol. Seems like this is for school or something.