Post

Replies

Boosts

Views

Activity

Reply to making random arrays more random
This is the code I used to get the user to generate the random questions the user is asked to answer:    @IBAction func questButton(_ sender: Any) {         let array = [" my various questions are listed here"] (example of the questions......"The first astronaut to step on the Moon was John Glenn", "The largest continent is Australia", "The Chicago Cubs won the World Series in 2015", "Delaware was the first state in the modern United States", "Alaska was the last state in the modern United States")             questLabel.text = array.randomElement()   } I have a 90 second timer built into the app, I want the user to see how many they can answer "True" or "False" in that time. The app is supposed to display a different question every time the user clicks on the "questButton" but it tends to repeat them frequently. I have a list of about 60 plus questions, but when I test it I can get 5 or 6 questions that keep popping up, and they are not always the same questions. Because it is tracking the CORRECT or WRONG answers, the fact that they repeat makes it easy for the user to get the same question correct over and over again.
Jul ’20
Reply to making random arrays more random
I just keyed in your suggestion and ran the app.....it is much better than it was THANK YOU. I have 65 questions so far, and in my test in the first 25 question it repeated 3 questions, but my original version was almost triple that. When I retired I took up trying to write apps as a dare for my grandkids so I am just short of a "newbie". I hope some day I can look at code and understand it and be able to help someone the way you have helped me. I really can't tell you how much I appreciate your help.....THANK YOU so much for the help and being so quick to respond!! jmroz51
Jul ’20