0
How does the code playground compile and execute code ? All in a single second or segmented
The main reason l am putting this question out here is that my code that lam working on is using the srand , rand and time functions to generate random numbers for variables in my code and i have been getting very weird results back. For example i have two arrays that the code fills with numbers between 1 and 4 in the first and 1 and 10 in the second. In every situation i was getting the same result, in this case 4/2. I am wondering if this because of my code or its just how the compiler has to work.
2 Antworten
+ 3
Probably not the compiler, or indirectly, but as execution of the compiled code is done in a special way ( as for input/output is some buffering stuff ), it may occurs others particularities... Unfortunatly, I'm afraid that we may do ourselves tests to discover where and how are limitations ^^
0
fair enough , i was findinh the input and output using c++ in the code playground weird.
was also having some problems when declaring a class and it used rand functionality , so i think the rand function can only really used to make a single random number per statement in the code in c++.