Picking few Data from Firebase

How can I pick 20 Random Data from Firebase:firebase:?

I think this will work well:

  1. Get all the tags from Firebase as a list. Let the list be X items long.
  2. Create a new empty list Y (this will be the final list of 20 data items)
  3. Run a loop 20 times
  4. In each iteration of the loop, pick a random n number between 1 and X.
  5. Get the nth element in your list of all tags.
  6. Add this element to list Y.
  7. Remove that element from the list of all tags.
  8. Decrement X by 1.

Hope this helps!

In that case, your program gets 20 random tags from FireBase DB. Get values paired with those tags using this block

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.