I need to randomly generate "-1" or "1" to randomly determine the sign of a number ... What is the shortest method? I am currently using this, but it looks pretty long:
sign = (round((arc4random() % 2)))-((round((arc4random() % 2))) == 0);
source
share