Skip to content

Instantly share code, notes, and snippets.

@adelevie
Created August 5, 2012 23:20
Show Gist options
  • Save adelevie/3267887 to your computer and use it in GitHub Desktop.
Save adelevie/3267887 to your computer and use it in GitHub Desktop.
count = PFQuery.queryWithClassName("Noun").countObjects
query = PFQuery.queryWithClassName("Noun")
query.limit = 1
query.skip = rand(count) # for the non-Rubyists, this just finds a random int between 0 and `count`
query.findObjects.first
@heohni
Copy link

heohni commented Mar 20, 2015

Hi,
is there any "newer" solution? Maybe in Swift? And how do I query for a number > 1 random objects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment