There must be something wrong with your local rand function because I cannot get a unique, random number for your shopping cart. Please check the call to rand in the Assign a Shopping Cart routine.