Fix build failure without zlib.
Fix test failure without zlib.
Use archive_random() function instead of rand() function.