OLD | NEW |
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 #include "webrtc/rtc_base/helpers.h" | 11 #include "webrtc/base/helpers.h" |
12 | 12 |
13 #include <limits> | 13 #include <limits> |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include <openssl/rand.h> | 16 #include <openssl/rand.h> |
17 | 17 |
18 #include "webrtc/rtc_base/base64.h" | 18 #include "webrtc/base/base64.h" |
19 #include "webrtc/rtc_base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/rtc_base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/rtc_base/logging.h" | 21 #include "webrtc/base/logging.h" |
22 #include "webrtc/rtc_base/timeutils.h" | 22 #include "webrtc/base/timeutils.h" |
23 | 23 |
24 // Protect against max macro inclusion. | 24 // Protect against max macro inclusion. |
25 #undef max | 25 #undef max |
26 | 26 |
27 namespace rtc { | 27 namespace rtc { |
28 | 28 |
29 // Base class for RNG implementations. | 29 // Base class for RNG implementations. |
30 class RandomGenerator { | 30 class RandomGenerator { |
31 public: | 31 public: |
32 virtual ~RandomGenerator() {} | 32 virtual ~RandomGenerator() {} |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } while (id == 0); | 209 } while (id == 0); |
210 return id; | 210 return id; |
211 } | 211 } |
212 | 212 |
213 double CreateRandomDouble() { | 213 double CreateRandomDouble() { |
214 return CreateRandomId() / (std::numeric_limits<uint32_t>::max() + | 214 return CreateRandomId() / (std::numeric_limits<uint32_t>::max() + |
215 std::numeric_limits<double>::epsilon()); | 215 std::numeric_limits<double>::epsilon()); |
216 } | 216 } |
217 | 217 |
218 } // namespace rtc | 218 } // namespace rtc |
OLD | NEW |