Originally Posted by Randdalf
Yes. You just generate two random numbers and pick the largest. Mashing involves recording player inputs over a length of time as well as having some kind of base AI mash rate... I'd say randomness is a lot easier.
While I agree that dice roll would be easier (because I too learned how to do that in my single C++ class) all you'd need is a win/fail state based on input and time, like "player must hit button 10 times in 3 seconds" or whatever parameters desired. You don't need to the AI to do anything at all.