I am having problem understanding the random input into the array.
Also, I must use a seed value of 20.
Is this the appropriate code for this?
mainArray[currPos] = 20 + rand()%41;
Thanks in advance
I am having problem understanding the random input into the array.
Also, I must use a seed value of 20.
Is this the appropriate code for this?
mainArray[currPos] = 20 + rand()%41;
Thanks in advance
Last edited by djay86; 04-17-2012 at 05:17 PM.
The for loop will loop it as many times as you choose SIZE to be.Code:for(i=0;i<SIZE;i++) mainArray[i] = 20 + rand()%41
I think that calculation is wrong. If the minimum is 10 then it should be 10 and not 20.
Also low + rand() % (high - low + 1) is clearest expression.