diff --git a/common/tier4_autoware_utils/include/tier4_autoware_utils/ros/uuid_helper.hpp b/common/tier4_autoware_utils/include/tier4_autoware_utils/ros/uuid_helper.hpp index 5b2f197c18827..ab3ca18097e54 100644 --- a/common/tier4_autoware_utils/include/tier4_autoware_utils/ros/uuid_helper.hpp +++ b/common/tier4_autoware_utils/include/tier4_autoware_utils/ros/uuid_helper.hpp @@ -17,10 +17,21 @@ #include +#include #include namespace tier4_autoware_utils { +inline unique_identifier_msgs::msg::UUID generateUUID() +{ + // Generate random number + unique_identifier_msgs::msg::UUID uuid; + std::mt19937 gen(std::random_device{}()); + std::independent_bits_engine bit_eng(gen); + std::generate(uuid.uuid.begin(), uuid.uuid.end(), bit_eng); + + return uuid; +} inline std::string toHexString(const unique_identifier_msgs::msg::UUID & id) { std::stringstream ss;