0

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?

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
Lucas
  • 3
  • 1

1 Answers1

0

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.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150