int totalRecs = getTotalRecs(); // returns '13'
int MAX_RECS_PER_LOOKUP = 10;
Random rand = new Random();
int start = (totalRecs > Utl.MAX_RECS_PER_LOOKUP) ? rand.nextInt(totalRecs-Utl.MAX_RECS_PER_LOOKUP) : 0;
results = this.getNewRecs(filter, start, start+1);
I'm using this random number logic to retrieve records from the database based on their table row offset (start up to start+1).
But for some reason it keeps repeating the same numbers: start value of 0 and start value of 3.
I tried seeding the Random object but it made no difference:
long seed = System.currentTimeMillis();
rand.setSeed(seed);