You'll get the same values every time unless you put a call to srand before the loop.