Quantcast
Channel: android random number problem - Stack Overflow
Browsing index pages (3 articles)
↧

android random number problem

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...

View Article


Answer by Mark B for android random number problem

First, I would try moving the line:Random generator = new Random();To your class's constructor or some other place where it will only get created once. That should definitely help.Other than that, the...

View Article


Answer by DragonLord for android random number problem

Based on your description, your database query is 1's-based. Java nextInt is 0's-based, that is, .nextInt(10) will generate a random number between 0 and 9. So your proper solution is to change line 3...

View Article
Browsing index pages (3 articles)


Latest Images