| 1 | // Copyright (C) 2017 Intel Corporation. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QRANDOM_P_H |
| 5 | #define QRANDOM_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qglobal_p.h" |
| 19 | #include <qrandom.h> |
| 20 | #include <private/qsimd_p.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | enum QRandomGeneratorControl { |
| 25 | UseSystemRNG = 1, |
| 26 | SkipSystemRNG = 2, |
| 27 | SkipHWRNG = 4, |
| 28 | SetRandomData = 8, |
| 29 | |
| 30 | // 28 bits |
| 31 | RandomDataMask = 0xfffffff0 |
| 32 | }; |
| 33 | |
| 34 | enum RNGType { |
| 35 | SystemRNG = 0, |
| 36 | MersenneTwister = 1 |
| 37 | }; |
| 38 | |
| 39 | #if defined(QT_BUILD_INTERNAL) |
| 40 | extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control; |
| 41 | #else |
| 42 | static const struct |
| 43 | { |
| 44 | uint loadAcquire() const { return 0; } |
| 45 | } qt_randomdevice_control; |
| 46 | #endif |
| 47 | |
| 48 | QRandomGenerator::InitialRandomData qt_initial_random_value() noexcept; |
| 49 | |
| 50 | QT_END_NAMESPACE |
| 51 | |
| 52 | #endif // QRANDOM_P_H |
| 53 | |