Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Randall Lakey
Randall Lakey
2,486 Points

Android Development;Stage 2 Learning the Language challenge task

I feel like I am doing this right but I am getting an error. Can anyone verify this please? The answer is line 2. Thank you in advance.

Now limit the range of the randomNumber variable from 0 to 9. Use the version of 'nextInt()' that has a parameter that specifies how many numbers to choose from.

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

random.java

1Random randomGenerator = new Random();

2int randomNumber = randomGenerator.nextInt(3);

3 Answers

Patrick Cooney
Patrick Cooney
12,216 Points

Hint: Check the argument you are providing to nextInt().

Randall Lakey
Randall Lakey
2,486 Points

Iam so new to this stuff....."check the argument"? Are you speaking in Chinese parables ? :)

Patrick Cooney
Patrick Cooney
12,216 Points

Sorry. Argument and parameter are somewhat interchangeable. What Ben calls the parameter in this example I called the argument. It's what you passed into the ( ) at the end. Try changing that number.

Randall Lakey
Randall Lakey
2,486 Points

I will try changing the number. Thank you.