Thread 1: EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)

I'm getting the following error: Thread 1: EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0). The console is printing lldb, How would I go about fixing this?

1
2
3
4
5
6
int rnd_num(int min, int max) {
    int x;
    srand((unsigned)time(0));
    x = rand() % max + min;
    return x;
}
Last edited on
Whoops! Easy fix: change
int rnd_num(int min, int max) { int rnd_num(int max, int min) {

Reason for is that the maximum number is less than the minimal number.
Topic archived. No new replies allowed.