When I build the code from the BNREmployee example in the book it builds fine. But when I run it I get an error at the line for getting a random employee number:
[code]//Get a random number between 0 and 9 inclusive
NSUInteger randomIndex = random() % [employees count];
Thread 1: EXC_ARITHMETIC (code = EXC_I386_DIV, subcode=0x0)
[/code]
I looked into the documentation but could not find reference to random().
[quote]//Get a random number between 0 and 9 inclusive
NSUInteger randomIndex = random() % [employees count];
Thread 1: EXC_ARITHMETIC (code = EXC_I386_DIV, subcode=0x0)
[/quote]
That says: You are dividing by zero!
Remember that the result of division by zero is undefined in math.
Thanks. It looks like I had about 3 lines of code across three files that weren’t there. It caused the array to not populate. Works like a champ now.