Select a Random row in realm table
问题 I want to select a random row from the realm table. Something like - SELECT * FROM table ORDER BY RANDOM() LIMIT 1; 回答1: Something like this would do, yes? Random random = new Random(); RealmResults<YourTable> list = realm.where(YourTable.class).findAll(); YourTable yourTable = list.get(random.nextInt(list.size())); 回答2: Depends on what you want to do: Do you want to get a random row from a table? Or A (random) row from a random table? I guess you mean the former: If you have an id in your