+ 4

What is rand in C++

rand

14th Mar 2018, 1:57 AM
funny kids
funny kids - avatar
7 Answers
+ 50
rand() can be used to generate random numbers. For more information, refer http://www.cplusplus.com/reference/cstdlib/rand/
14th Mar 2018, 2:18 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 20
https://www.sololearn.com/learn/CPlusPlus/1638/
14th Mar 2018, 2:43 AM
Vukan
Vukan - avatar
+ 5
The C++11 standard introduced the <random> header to replace rand. Using rand is no more best practice.
14th Mar 2018, 5:25 AM
Timon Paßlick
+ 2
rand() is used with stand to get randomized numbers. It means it gives different numbers on different times. It retuens any of 0 to n-1 number. It is more useful than randomize() and random()
14th Mar 2018, 10:13 AM
Vishwajeet
Vishwajeet - avatar
+ 1
@Raghav Is that Python? Because it's definitely not part of STL.
21st Mar 2018, 2:37 PM
Timon Paßlick
0
random function when used like random(n); it will produce any number from 0 to n-1 randomly
21st Mar 2018, 2:31 PM
Raghav
Raghav - avatar
0
2
29th May 2019, 4:30 AM
حسين بيسو
حسين بيسو - avatar