Tried to create a random method that would query the database, obtain the number of rows in the database, and then grab a random number between 1 and the total number of rows to fetch a specific item in the database. It works alright, but not great, if there are less than ten entries in the database it will repeat the same entry about 4 out of ten times. I think I need a lead on a better method.
number = mDbHelper.getCount(mDbHelper.mDb);
Random generator = new Random();
n = generator.nextInt((int) number);
if(n <= 1){
n = 1;
}
Any ideas?