The issue that I'm having is how to randomly generate the a random number and then randomly distribute the product over 10 variables. The product of all 10 percentage variables should equal 100% of the total given in the first random function.
Here's an example of what I mean:
x= randomly generated number from 10000-25000
a=(random)% of x
b=(random)% of x
c=(random)% of x
d=(random)% of x
e=(random)% of x
f=(random)% of x
g=(random)% of x
h=(random)% of x
i=(random)% of x
j=(random)% of x
x=sum(a,b,c,d,e,f,g,h,i,j)=100% of x
The result only requires a number greater than 0 and repeated percentages are not a problem as long as they are randomly generated.
Thanks for any input, I'm still learning C# after a long recess from C++
Loading
Sam HobbsPosted Nov 30, 2010, 8:10 PM
JohnPosted Nov 30, 2010, 3:54 PM
Sam HobbsPosted Nov 30, 2010, 2:39 AM
Sum all percentages that have been obtained; in the beginning, that would be zero of course. Subtract the sum from 100 and use the result as the range for the next random number generation. Of course yoiu don't need to do the sum each time; you can simply subtract the previous percentage from the previous range to get the next range.
So in other words, randomly generate percentages.