Help with random numbers
#1

Hi all. I would like to create system: it will be 5 variables, after my action system will add random number to all variables, but total amount will be 100 ( variable1 + variable2 + variable3 + variable4 + variable5 = 100 ). How to create it? I know, how to create variables, add random number, but how to keep total amount = 100?
Reply
#2

PHP код:
new var[5];
for(new 
i4i++)var[i]=10+random(10);
var[
4]=100-var[3]-var[2]-var[1]-var[0]; 
Reply
#3

Thanks man!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)