I'm trying to show the user profiles of various users like tinder but I was wondering will the firebase always shows the user who registered first to other new users or if the iteration is random which will guarantee that the result will be random and everyone chances of getting displayed are equal? If not does someone knows how to make it random in android? How I'm doing it is
FirebaseDatabase.getInstance().getReference().child("Users").child(OppositeUserSex);
Edit This is the code where I think sorting wouldn't help because I want it to be random
if(mAuth.getCurrentUser().isEmailVerified())
{
FirebaseDatabase.getInstance().getReference().child("Users").child(UserSex).child(currentUserID).child("isVerified").setValue(true);
}
DatabaseReference oppositeSexDB= FirebaseDatabase.getInstance().getReference().child("Users").child(OppositeUserSex);
System.out.println(OppositeUserSex + "oppositeUser");
oppositeSexDB.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull @NotNull DataSnapshot snapshot, @Nullable @org.jetbrains.annotations.Nullable String previousChildName) {
if(snapshot.exists())
{
if(!snapshot.child("Selection").child("Nah").hasChild(currentUserID)) {
if(snapshot.child("Url").exists() && snapshot.child("isVerified").exists()) { //If user has image only then show them else dont display them && if they are verified
items.add(new ItemModel(snapshot.child("Url").getValue().toString(), snapshot.child("Name").getValue().toString(), "", "", snapshot.getKey()));
}
adapter.notifyDataSetChanged();
}
}
}