1. Member
Join Date
Feb 2013
Posts
13
Rep Power
0

## Random number

Thanks for all the help!
Last edited by Hawks; 04-30-2013 at 03:49 AM.

2. Member
Join Date
Apr 2013
Posts
41
Rep Power
0

## Re: Random number

i figure your new so atleast look this over...

Java Code:
```int total = 0, count = 0, r;
Random randomGenerator = new Random();

do{
r = randomGenerator.nextInt(11)+1;
total = total + r;
count++;
}
while(total <= 21);
System.out.println(count);
}```

3. Member
Join Date
Feb 2013
Posts
13
Rep Power
0

## Re: Random number

Thank you so much, you are amazing!

4. ## Re: Random number

Don't edit your posts like that. Now this post is of no value to anyone else.

5. ## Re: Random number

Here's the original content:

-

How would I generate random numbers between 1-11 and when they total up to 21 or greater the systems tells me how many generated
numbers there were that added up to 21?

I have this so far, I think I am suppose to use RandomNumber command.

for (int i = 1; i < 11; i++)
kind regards,

Jos

6. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
5,743
Rep Power
10

## Re: Random number

OP aksed, "How would I generate random numbers between 1-11 and when they total up to 21 or greater the systems tells me how many generated
numbers there were that added up to 21?"

Hmm, what is the count when the first eight generated numbers are 4,8,3,2,4,9,10,1?

Regards,
Jim

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•