Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (retired 2014) Learning the Language Objects and Random Numbers

Jorge Hurtado
Jorge Hurtado
1,675 Points

Bummer! Check the parameter you're using for 'nextInt()'. Hint: 0 through 9 is a total of 10 choices.

im having a problem with this coding. i entered int randomNumber = randomGenerator();

2 Answers

william parrish
william parrish
13,774 Points

Well, from what i remember, and what the error message is prompting you, you did not define the range for your random numbers.

If its asking you to generate random numbers, you will as indicated need to put in 10 : int randomNumber =randomGenerator(10); A good rule of thumb, is since the random number generator starts with / includes 0, just add 1 to whatever your literal limit is. IE random numbers stopping at '25' would be 26, and so on.

Your code is somewhat incomplete there. What's the code you used to pass task 2?