diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 21:03:54 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 21:03:54 +0000 |
commit | 29548d8d4f224f681c70e85a7fa0466dff4df92f (patch) | |
tree | 12cd6faa39cb43e879e907f09ab9734156724ce0 /base/rand_util.h | |
parent | deaa35b7bad1d06f28ed394fb850b4f3dd7bc871 (diff) | |
download | chromium_src-29548d8d4f224f681c70e85a7fa0466dff4df92f.zip chromium_src-29548d8d4f224f681c70e85a7fa0466dff4df92f.tar.gz chromium_src-29548d8d4f224f681c70e85a7fa0466dff4df92f.tar.bz2 |
Add a rand_util method for generating a random string.
We need this function to generate a nonce for MAC cookies.
Review URL: http://codereview.chromium.org/6904118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/rand_util.h')
-rw-r--r-- | base/rand_util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/base/rand_util.h b/base/rand_util.h index a4ea479..4e902da 100644 --- a/base/rand_util.h +++ b/base/rand_util.h @@ -6,6 +6,8 @@ #define BASE_RAND_UTIL_H_ #pragma once +#include <string> + #include "base/base_api.h" #include "base/basictypes.h" @@ -27,6 +29,9 @@ BASE_API uint64 RandGenerator(uint64 max); // Returns a random double in range [0, 1). Thread-safe. BASE_API double RandDouble(); +// Returns a random string of the specified length. +BASE_API std::string RandBytesAsString(size_t length); + } // namespace base #endif // BASE_RAND_UTIL_H_ |