Android Build a Simple Android App Basic Android Programming Using the Random Class

Now limit the range of the randomNumber variable from 0 to 9. Use the version of nextInt() that takes a parameter specif

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

RandomTest.java
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt();
int randomNumber = randomGenerator.nextInt(10);

1 Answer

Juthawong Naisanguansee
Juthawong Naisanguansee
Full Stack JavaScript Techdegree Graduate 79,755 Points

Hello Jasper , You are doing great. Just Remove the first int randomNumber :)

Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String intAsString = randomNumber + "";