I want to develop an app that gives a random quote every time you change the page. And I want to put like 1000 quotes in the database. How is the best way I can get a Random Quote? arc4random?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To extend the answer you were given on selecting a method to generate a random number – choose a random number method, and have an index for each quote in the DB so that you can query a quote directly from the random number you compute.
Also you can get counts directly from Core Data (without doing a real query) to figure out the range of random numbers you want to ask for.