Add '.unwrap()' after '.lock()' because of recent change in Mutex API.
Change 'task_rng' to 'thread_rng' because of change in `rand` API.