Index: webrtc/base/helpers.cc |
diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc |
index 0a39ee923e1d61b3db9fa6399aee34049595fff6..b284cd7a73237b5c4608cd4dd7187c79d4029ed4 100644 |
--- a/webrtc/base/helpers.cc |
+++ b/webrtc/base/helpers.cc |
@@ -245,6 +245,13 @@ bool CreateRandomString(size_t len, const std::string& table, |
static_cast<int>(table.size()), str); |
} |
+bool CreateRandomData(size_t length, std::string* data) { |
+ data->resize(length); |
+ // std::string is guaranteed to use contiguous memory in c++11 so we can |
+ // safely write directly to it. |
+ return Rng().Generate(&data->at(0), length); |
+} |
+ |
// Version 4 UUID is of the form: |
// xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx |
// Where 'x' is a hex digit, and 'y' is 8, 9, a or b. |