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 trialMelquisedec da Silva
1,132 PointsRandomTest.java, I can't pass it but I am not able to see what is wrong here on my codes on task 3 of 4
Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(8);
I should specify the numbers between 0 and 9 right?
1 Answer
Gunjeet Hattar
14,483 PointsHi Melquisedec,
The challenge says
Now limit the range of the randomNumber variable from 0 to 9
Just follow this convention nextInt starts numbering from 0 to get 9 we need to implement n+1, where n is the number in the range
So by rule it should be
int randomNumber = randomGenerator.nextInt(10);
Hope this helps
Melquisedec da Silva
1,132 PointsMelquisedec da Silva
1,132 PointsThank you Gunjeet, It is simple like that!!
Gunjeet Hattar
14,483 PointsGunjeet Hattar
14,483 PointsGlad it helped!