Optimization Patch(1)

Implemented a thread local random to generate random numbers. This
reduces contention.