add wait() for a thread into rand test case.