Random number generator between 0 - 100

I am trying to create a number generator between 0 - 100, this my code atm:

Could someone help me out?

Cheers


private void newGame()
	{
		
		numGames = i++;
		java.util.Random rand = new java.util.Random();
		i =rand.nextInt(100+1);
		theNumber = i;
	}

Open in new window

LVL 3
LyonJayAsked:
Who is Participating?
 
ksivananthConnect With a Mentor Commented:
or

theNumber = rand.nextInt(100+1);
0
 
ksivananthCommented:
whats the issue?
0
 
LyonJayAuthor Commented:
it's giving me cannot find symbol?

Is it a import issue?

Regards

Lyon JT
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
ksivananthCommented:
which line?
0
 
LyonJayAuthor Commented:
6, 7

Regards

Lyon JT
0
 
ksivananthCommented:
post the full code of the class otherwise!
0
 
ksivananthCommented:
try

int i = rand.nextInt(100+1);
theNumber = i;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.