Different no. every time i run it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Different no. every time i run it

we get the same number everytime by using just rand() How can i get a different no everytime.....i run the program

3rd Jun 2018, 5:10 AM
Sanchit Gupta
Sanchit Gupta - avatar
1 Answer
+ 10
Please see this lesson in C++. The use of srand() function with time() function to get the truly random numbers. https://www.sololearn.com/learn/CPlusPlus/1638/ You have posted the question twice. Please delete one.
3rd Jun 2018, 5:14 AM
Akash Pal
Akash Pal - avatar