+ 2

How can I set an int's value to be a rand int ?

I want to set c = rand int i.e ft||em...how can I set that ? https://code.sololearn.com/cNvBzo6OVa3F/?ref=app

30th Jun 2019, 4:36 AM
Foxie
Foxie - avatar
3 Respuestas
+ 4
if(rand() % 2 <= 1) c = ft else c = em; ~~ or ~~ c = rand() % 2 <= 1 ? ft : em;
30th Jun 2019, 7:37 AM
Anna
Anna - avatar
+ 2
Thanks a lot .....Now I can set the moves to random !! 😃😃😃🙌🙌🙌
30th Jun 2019, 7:46 AM
Foxie
Foxie - avatar
+ 1
Then what is its alternative ?
30th Jun 2019, 10:29 AM
Foxie
Foxie - avatar