diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-20 13:37:58 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-14 09:59:36 +0200 |
commit | 9ee554ac1d1af97e7ad5b4bf78e2779f7d1c405f (patch) | |
tree | c40e65aa3b2f7d02c32b592855c8c03252909c2b /src/corelib/global/qrandom.cpp | |
parent | ff555d89650f5cea72365e12fb2b71be9e25b89d (diff) |
qglobal.h: remove deprecated global functions
Since 5.0 - qMalloc(), qFree(), qRealloc(), qMemCopy(), qMemSet()
Since 5.15 - qsrand(), qrand()
Change-Id: I74fa3d17b05521271c3dc563fc85a5b133289ce3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qrandom.cpp')
-rw-r--r-- | src/corelib/global/qrandom.cpp | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 4ebe53d572..1d2a29c074 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -595,7 +595,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \snippet code/src_corelib_global_qrandom.cpp 3 - \sa QRandomGenerator64, qrand() + \sa QRandomGenerator64 */ /*! @@ -1242,62 +1242,4 @@ static inline QRandEngine *randTLS() } #endif -/*! - \relates <QtGlobal> - \deprecated - \since 4.2 - - Thread-safe version of the standard C++ \c srand() function. - - Sets the argument \a newSeed to be used to generate a new random number sequence of - pseudo random integers to be returned by qrand(). - - The sequence of random numbers generated is deterministic per thread. For example, - if two threads call qsrand(1) and subsequently call qrand(), the threads will get - the same random number sequence. - - \note This function is deprecated. In new applications, use - QRandomGenerator instead. - - \sa qrand(), QRandomGenerator -*/ -void qsrand(uint newSeed) -{ - auto prng = randTLS(); - if (prng) - prng->seed(newSeed); - else - srand(newSeed); -} - -/*! - \relates <QtGlobal> - \deprecated - \since 4.2 - - Thread-safe version of the standard C++ \c rand() function. - - Returns a value between 0 and \c RAND_MAX (defined in \c <cstdlib> and - \c <stdlib.h>), the next number in the current sequence of pseudo-random - integers. - - Use \c qsrand() to initialize the pseudo-random number generator with a - seed value. Seeding must be performed at least once on each thread. If that - step is skipped, then the sequence will be pre-seeded with a constant - value. - - \note This function is deprecated. In new applications, use - QRandomGenerator instead. - - \sa qsrand(), QRandomGenerator -*/ -int qrand() -{ - auto prng = randTLS(); - if (prng) - return prng->generate(); - else - return rand(); -} - QT_END_NAMESPACE |