Add random.cpp, revise hash_pair.cpp