Fix srand init the thread safe way