+ 2

Headerfile of random function

How can i use random function here when stdlib is not working https://code.sololearn.com/c36k5OB1QV0x/?ref=app

9th Oct 2017, 3:51 PM
MMN
MMN - avatar
2 ответов
+ 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.
9th Oct 2017, 4:41 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 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
9th Oct 2017, 4:21 PM
Highman
Highman - avatar