Use the TR1 random number generator instead of rand().