Clay Dagler
Posts: 21
Nickname: cdagler
Registered: Jul, 2003
|
|
Re: Random Number generator question.
|
Posted: Jun 25, 2004 10:59 PM
|
|
> Okay, I'm very new to this, so forgive me if the question > is a little elementary. I was wondering if a random number > generator could be set up so the numbers it generates add > up to a certain value. Thanks.
Is this what you want?
int certainValue = 173; //just an example. int[] someNums; storeRandomNums(someNums); int lastNum = certainValue-sumOf(someNums);
The random numbers you want are someNums[0], ..., someNums[someNums.length-1], lastNum.
|
|