title: Firebase - Get Random Child From Database Node
body: <p>I'm writing a <code>Firebase Cloud Function</code> that is called from an <code>Android</code> app. The function should get a random user from the users node in the <code>Database</code> (Any random user but not the one who sent the request) and return it to the client. The problem is that the data is not structured as an array (And it should not be and can't be).</p>
  
  <p><a href="https://i.stack.imgur.com/oJhTb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJhTb.png" alt="Data structure in the database."></a></p>
  
  <p>So I can't pick a random number and read that node, I also don't want to read all the users node and iterate it because it contains a lot of users and that would be time and resources-consuming. <strong>The Question:</strong></p>
  
  <blockquote>
    <p>How can I get a random user different from the one who sent the request, and changes with every time the function is called (completely random), while not querying a lot of data from the database?</p>
  </blockquote>