Why Laptop 3 is unassigned? NEED HELP!

When checking the output, I am wondering why Laptop 3 is unassigned.anyone can explain?
I understund why laptop 5 is unassigned because its holder has been removed from the mutable array. But the code did nothing with laptop 3! I am curious about that.

[code] #import <Foundation/Foundation.h>
#import “BNREmployee.h”
#import “BNRAsset.h”

int main(int argc, const char * argv[]) {
@autoreleasepool {

    NSMutableArray *employees=[[NSMutableArray alloc] init];
    
    for(int i=0;i<10;i++){
        BNREmployee *mikey=[[BNREmployee alloc] init];
        mikey.weightInKilos=90+i;
        mikey.heightInMeters=1.8-i/10.0;
        mikey.employeeID=i;
        [employees addObject:mikey];

    }
    NSMutableArray *allAssets=[[NSMutableArray alloc] init];
    
        for(int i=0;i<10;i++){
        BNRAsset *asset=[[BNRAsset alloc] init];
        NSString *currentLabel=[NSString stringWithFormat:@"Laptop %d",i];
        asset.label=currentLabel;
        asset.resaleValue=350+i*17;
        NSUInteger randomIndex=random()%[employees count];
        
        BNREmployee *randomEmployee=[employees objectAtIndex:randomIndex];
        [randomEmployee addAssets:asset];
        [allAssets addObject:asset];
        //if(randomIndex<3)
        //[randomEmployee removeAssets:asset];
    }
    NSLog(@"Employee: %@",employees);
    
    NSLog(@"Giving up ownership of one employee");
    [employees removeObjectAtIndex:5];
    NSLog(@"allAssets:%@",allAssets);
    NSLog(@"Giving up ownership of arrays");
    allAssets=nil;
    employees=nil;
}
sleep(100);
return 0;

}
[/code]

the result

2015-09-17 15:54:41.844 BMITime[750:24659] Employee: (
    "<Employee 0:$0 in assets>",
    "<Employee 1:$503 in assets>",
    "<Employee 2:$469 in assets>",
    "<Employee 3:$768 in assets>",
    "<Employee 4:$0 in assets>",
    "<Employee 5:$836 in assets>",
    "<Employee 6:$819 in assets>",
    "<Employee 7:$384 in assets>",
    "<Employee 8:$0 in assets>",
    "<Employee 9:$486 in assets>"
)
2015-09-17 15:54:41.845 BMITime[750:24659] Giving up ownership of one employee
2015-09-17 15:54:41.845 BMITime[750:24659] deallocating <Employee 5:$836 in assets>
2015-09-17 15:54:41.845 BMITime[750:24659] allAssets:(
    "<Laptop 0: $350,assigned to <Employee 3:$768 in assets>>",
    "<Laptop 1: $367,assigned to <Employee 6:$819 in assets>>",
    "<Laptop 2: $384,assigned to <Employee 7:$384 in assets>>",
   [b][u] "<Laptop 3: $401 unassigned>",[/u][/b]
    "<Laptop 4: $418,assigned to <Employee 3:$768 in assets>>",
  [b][u]  "<Laptop 5: $435 unassigned>",[/u][/b]
    "<Laptop 6: $452,assigned to <Employee 6:$819 in assets>>",
    "<Laptop 7: $469,assigned to <Employee 2:$469 in assets>>",
    "<Laptop 8: $486,assigned to <Employee 9:$486 in assets>>",
    "<Laptop 9: $503,assigned to <Employee 1:$503 in assets>>"
)
2015-09-17 15:54:41.845 BMITime[750:24659] Giving up ownership of arrays
2015-09-17 15:54:41.845 BMITime[750:24659] deallocating <Laptop 3: $401 unassigned>
2015-09-17 15:54:41.846 BMITime[750:24659] deallocating <Laptop 5: $435 unassigned>
2015-09-17 15:54:41.846 BMITime[750:24659] deallocating <Employee 0:$0 in assets>
2015-09-17 15:54:41.850 BMITime[750:24659] deallocating <Employee 1:$503 in assets>
2015-09-17 15:54:41.850 BMITime[750:24659] deallocating <Laptop 9: $503 unassigned>
2015-09-17 15:54:41.850 BMITime[750:24659] deallocating <Employee 2:$469 in assets>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Laptop 7: $469 unassigned>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Employee 3:$768 in assets>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Laptop 0: $350 unassigned>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Laptop 4: $418 unassigned>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Employee 4:$0 in assets>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Employee 6:$819 in assets>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Laptop 1: $367 unassigned>
2015-09-17 15:54:41.851 BMITime[750:24659] deallocating <Laptop 6: $452 unassigned>
2015-09-17 15:54:41.852 BMITime[750:24659] deallocating <Employee 7:$384 in assets>
2015-09-17 15:54:41.852 BMITime[750:24659] deallocating <Laptop 2: $384 unassigned>
2015-09-17 15:54:41.852 BMITime[750:24659] deallocating <Employee 8:$0 in assets>
2015-09-17 15:54:41.852 BMITime[750:24659] deallocating <Employee 9:$486 in assets>
2015-09-17 15:54:41.852 BMITime[750:24659] deallocating <Laptop 8: $486 unassigned>

You probably figured it out by now, but laptop 3 and 5 were probably both assigned to the same employee. You were assigning assets by generating a random index, so some employees can have more than one asset, and others none. You could verify it by printing the employeeID of the randomEmployee when you assign the assets.

            NSLog(@"Adding %@ to employee %u", asset.label, randomEmployee.employeeID);
            [randomEmployee addAssets:asset];
            NSLog(@"Employee assets: %@", randomEmployee.assets);
            [allAssets addObject:asset];

Or simply list the assets for each employee before you remove your employee.

        for (BNREmployee *e in employees) {
            NSLog(@"Employee %u has these assets:\n%@", e.employeeID, e.assets);
        }

EDIT: hehe, I should have read the next section in the book. Thats exactly what happened.