0

Why we need such a function rand(); which give us random numbers ?

means in which situation it is useful

16th Mar 2017, 4:52 AM
Saiyyed aman ali
Saiyyed aman ali - avatar
4 Réponses
+ 1
In case you want to generate random password for user, for example.
16th Mar 2017, 4:54 AM
Ivan G
Ivan G - avatar
0
but we get same numbers when run again so always it gives same password for others too is this correct or not
16th Mar 2017, 4:58 AM
Saiyyed aman ali
Saiyyed aman ali - avatar
0
yea i understand for changing passwords we use seed values by srand(); function 👍
16th Mar 2017, 5:07 AM
Saiyyed aman ali
Saiyyed aman ali - avatar
0
Then you have to use some other random generating library, because rand works badly. Look http://en.cppreference.com/w/cpp/numeric/random And still if you want a random password, you have to use some random number generator.
16th Mar 2017, 5:08 AM
Ivan G
Ivan G - avatar