add a lock when generate Intn

Because method Intn() not locked in rand lib. So it should add a lock when generate Intn