Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: webrtc/base/helpers.h

Issue 2877023002: Move webrtc/{base => rtc_base} (Closed)
Patch Set: update presubmit.py and DEPS include rules Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/gunit_prod.h ('k') | webrtc/base/helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_BASE_HELPERS_H_ 11 #ifndef WEBRTC_BASE_HELPERS_H_
12 #define WEBRTC_BASE_HELPERS_H_ 12 #define WEBRTC_BASE_HELPERS_H_
13 13
14 #include <string>
15 #include "webrtc/base/basictypes.h"
16 14
17 namespace rtc { 15 // This header is deprecated and is just left here temporarily during
18 16 // refactoring. See https://bugs.webrtc.org/7634 for more details.
19 // For testing, we can return predictable data. 17 #include "webrtc/rtc_base/helpers.h"
20 void SetRandomTestMode(bool test);
21
22 // Initializes the RNG, and seeds it with the specified entropy.
23 bool InitRandom(int seed);
24 bool InitRandom(const char* seed, size_t len);
25
26 // Generates a (cryptographically) random string of the given length.
27 // We generate base64 values so that they will be printable.
28 std::string CreateRandomString(size_t length);
29
30 // Generates a (cryptographically) random string of the given length.
31 // We generate base64 values so that they will be printable.
32 // Return false if the random number generator failed.
33 bool CreateRandomString(size_t length, std::string* str);
34
35 // Generates a (cryptographically) random string of the given length,
36 // with characters from the given table. Return false if the random
37 // number generator failed.
38 // For ease of implementation, the function requires that the table
39 // size evenly divide 256; otherwise, it returns false.
40 bool CreateRandomString(size_t length, const std::string& table,
41 std::string* str);
42
43 // Generates (cryptographically) random data of the given length.
44 // Return false if the random number generator failed.
45 bool CreateRandomData(size_t length, std::string* data);
46
47 // Generates a (cryptographically) random UUID version 4 string.
48 std::string CreateRandomUuid();
49
50 // Generates a random id.
51 uint32_t CreateRandomId();
52
53 // Generates a 64 bit random id.
54 uint64_t CreateRandomId64();
55
56 // Generates a random id > 0.
57 uint32_t CreateRandomNonZeroId();
58
59 // Generates a random double between 0.0 (inclusive) and 1.0 (exclusive).
60 double CreateRandomDouble();
61
62 } // namespace rtc
63 18
64 #endif // WEBRTC_BASE_HELPERS_H_ 19 #endif // WEBRTC_BASE_HELPERS_H_
OLDNEW
« no previous file with comments | « webrtc/base/gunit_prod.h ('k') | webrtc/base/helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698