Why my code doesn't generate different values for x and f ? it should be random
p is random, but it generates only a random value once. Shouldn't p be in the loop?
you are getting the values after 10000 iterations. Also, the range of values is not big and you are rounding. The average values of a large sample with small fluctuation will be a stable one. Try 5 loops, the value fluctuation is more apparent.
The reason your code is not generating different values for x and f is because you are not reassigning the values of initial and end within the loop. Therefore, the subsequent iterations of the loop are using the same initial and end values, resulting in the same calculations being performed each time. To generate different values for x and f in each iteration, you should move the assignment of initial and end inside the loop By moving the assignment of end inside the loop, you will ensure that a different end value is used for each iteration, resulting in different calculations and different values for x and f.