get random value android firebase java

后端 未结 1 1879
难免孤独
难免孤独 2020-12-10 19:52

I want to get a random from my list by using push() in java.

Here is my code to store my data:

                Firebase publRef = f.child(\"Language\         


        
相关标签:
1条回答
  • 2020-12-10 20:47

    Find out the number of possible values (numvals) in the database and then use that in

    int random = new Random().nextInt(numvals);
    

    and select the "random"th entry in your database.

    0 讨论(0)
提交回复
热议问题