pitrou commented on code in PR #44005:
URL: https://github.com/apache/arrow/pull/44005#discussion_r1763253477


##########
cpp/src/arrow/io/hdfs_test.cc:
##########
@@ -84,15 +81,29 @@ class TestHadoopFileSystem : public ::testing::Test {
     return ss.str();
   }
 
+  // Generate random string for unique path creation. Boost::filesystem does 
this with
+  // unique_path() which does not exist in std::filesystem
+  std::string generate_rand_string(size_t length = 4) {
+    const char hexchars[] = "0123456789abcdef";
+    std::random_device rd;
+    std::mt19937 generator(rd());
+    std::uniform_int_distribution<> distribution(0, 15);
+
+    std::string random_hex_string;
+    for (size_t i = 0; i < length; ++i) {
+        random_hex_string += hexchars[distribution(generator)];
+    }
+    return random_hex_string;
+  }

Review Comment:
   No need to replicate Boost's precise behavior, we can simplify this to 
something like (untested):
   ```suggestion
     std::string RandomSuffix() {
       std::default_engine gen(std::random_device());
       std::uniform_int_distribution<> suffix_dist(10000, 99999);
       return std::to_string(suffix_dist(gen));
     }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to