3
Answers

Generating random numbers and percentages of numbers

John

John

13y
2.4k
1

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++
Answers (3)