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 trialAmanda Oliver
324 PointsRandom Number
having trouble with task challenge 3. This is the answer I have, but it's not working.
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt( n: 9);
1 Answer
Rich Donnellan
Treehouse Moderator 27,708 PointsHey Amanda!
Check the error message you are seeing when failing this question. It's pretty helpful: Check the parameter you're using for 'nextInt()'. Hint: 0 through 9 is a total of 10 choices.
I haven't taken the course yet, but I was able to determine what to do by this alone. You might want to reconsider using n:
as well. Good luck! 👍🏻
Amanda Oliver
324 PointsAmanda Oliver
324 PointsThank you! This was very helpful. I was able to complete the task!