+ 2
Headerfile of random function
How can i use random function here when stdlib is not working https://code.sololearn.com/c36k5OB1QV0x/?ref=app
2 Answers
+ 3
Try pasting these defines before main to get random and randomize working.
#define randomize() srand(time(nullptr))
#define random(x) ((rand()%((x)-1)))
I used x-1, as random returns a number in range 0 to x-1.
+ 2
Hi,randomize is borland specific function.It is not standard C++.Insted of this please use srand a rand function like in the code below.
https://code.sololearn.com/ctBDUBb7jjvE/?ref=app