pitrou commented on code in PR #48943:
URL: https://github.com/apache/arrow/pull/48943#discussion_r2735558693
##########
cpp/src/arrow/testing/random.cc:
##########
@@ -1475,4 +1475,75 @@ void rand_month_day_nanos(int64_t N,
});
}
+std::string RandomUtf8String(int num_chars) {
+ std::random_device rd;
+ std::default_random_engine gen(rd());
+ std::string s;
+ s.reserve(num_chars * 3); // Reserve for average 3 bytes per codepoint
+
+ for (int i = 0; i < num_chars; ++i) {
+ uint32_t codepoint;
+ std::uniform_int_distribution<uint32_t> plane_dist(0, 3);
Review Comment:
I don't know how expensive it is to instantiate all those distributions at
each loop iteration. Perhaps they can be moved out of the loop.
--
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]