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 trialHenry Hayden
7,572 PointsIs question three broken?
This is my answer: int randomNumber = randomGenerator.nextInt( n: 9 ); I'm 99% certain that my answer is correct as this is just asking us to repeat what was just explained in the video. The actual parameter name for nextInt is 'bound' not 'n' like in the video, but it says that there's a compiler error and that my syntax is incorrect regardless of whether I use 'n' or 'bound'. Not sure if the question is broken or I'm just derping out, please help me get to the correct answer or fix the question if it turns out to be broken.
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(n:9);
2 Answers
Steven Parker
231,268 PointsSince the instructions say to "Use the version of nextInt() that takes a parameter specifying how many numbers to choose from", you only need to provide that quantity value as the argument.
And since the target range is "from 0 to 9", the quantity should be 10.
Henry Hayden
7,572 PointsThanks!