So basically
int num = rand(2); //random number from 0-2
int otherNum, otherOtherNum;
otherNum = implement this
otherOtherNum = implement this
For example, if num is 2, otherNum and otherOtherNum must be set to 0 and 1 (or 1 and 0).
How would you implement this? Assume you can't use branching or look up tables.
I think a lookup might be the fastest but not sure, I dont like that solution though.
Aucun commentaire:
Enregistrer un commentaire