What is the reason when we add #include<ctime> in our code and cout<<time(0)<<endl; always outputting random numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the reason when we add #include<ctime> in our code and cout<<time(0)<<endl; always outputting random numbers

27th Nov 2018, 4:44 PM
Faruq
Faruq - avatar
3 Answers
0
Эм привет
8th Dec 2018, 4:12 PM
Коля
0
Because this will take current time of system and time can never b same in your case. That's why it always generates random numbers.
13th Dec 2018, 7:43 AM
Jawad Adil
0
hello
16th May 2019, 3:12 AM
suxrob