Random Function
in
Programming Questions
•
1 year ago
Hello. I am trying to make a game of snake. There will be a question displaying on the top and I want it to be random. When the user uses his snake to eat the target food successfully, I want the question to regenerate into a different question. I have used a varible called "questions" and it works with the random() function. Before Void Setup, I have a line telling it to generate
. I want to tell the program that when ever my snake touches my target food, it should regenerate the question and how do I do that? Thanks.float questions = random(1, 3);int question = int(questions);
P.S. Just for more information, just like what I said, the program will first generate a number. Under void draw, I will post a question out according to the number that was generated. So if "2 == true" , question will appear.
Thanks!!!!
1