What is the different between rand () and srand () | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

What is the different between rand () and srand ()

15th Sep 2017, 1:22 PM
Vibeeshanan Vibee
Vibeeshanan Vibee - avatar
2 Respuestas
+ 4
rand gives you a pseudo random sequence of numbers. srand on each call sets the pointer to some location in the list which you are getting in . If you don't call it on each attempt or give it a fix seed it will give you the same sequence.
15th Sep 2017, 1:25 PM
Ekansh
- 1
what did we put the time(0) thats mean we write srand (time (0)) this type
15th Sep 2017, 1:46 PM
Vibeeshanan Vibee
Vibeeshanan Vibee - avatar