replaced rand generator by the thread-safe and uniform distribution variant