lundi 15 août 2016

choosing between 2 or more variables using rand() [duplicate]

This question already has an answer here:

I am wondering if I can use the rand() function to randomly choose between 2 variables. Say I have thing1 and thing2, can rand() choose one of them for me?

My current code just used rand() to generate a random number and I say if its odd then thing1 and if even then thing2 but if I add thing3 then it wont work..




Aucun commentaire:

Enregistrer un commentaire