I want to generate random numbers
randomnumberseed(M)=5
thenumberofrandomnumbersthatprogramshouldgenerate(N)=105
lowerbound(l)=-1
upperbound(u)=20 and
incrementrespectively(s)=0.01
srand(M);
for (i = 1; i <= N; i++) {
rn = (l + (size) *(double)rand() / RAND_MAX);
printf("%10.3f", rn);
So my random numbers must be like:
-0.460 12.930 16.550 12.490 2.600 19.300 7.270 7.490 0.720 10.400
8.140 9.210 8.330 5.760 3.260 0.070 13.630 11.070 15.500 11.310
And then i want to count the numbers which in the same interval(range will be divided 30 equal interval like (u-l)/30) and must to display.
First, i can generate random number between range but i can't provide incrementation respectively with s(0.01).
Secondly, how can i count intervals frequency? with an array or counter?
waiting for your urgent help :((((
Aucun commentaire:
Enregistrer un commentaire