Changed all random to use thread local random