KRandom
KRandom Namespace Reference
Functions | |
KCOREADDONS_EXPORT int | random () |
KCOREADDONS_EXPORT QString | randomString (int length) |
template<typename T > | |
void | shuffle (T &container) |
template<typename T > | |
void | shuffle (T &container, QRandomGenerator *generator) |
Detailed Description
Helper class to create random data.
This namespace provides methods which generate random data. KRandom is not recommended for serious random-number generation needs, like cryptography.
Function Documentation
◆ random()
int KRandom::random | ( | ) |
Generates a uniform random number.
- Returns
- A random number in the range [0, RAND_MAX). The RNG is seeded on first use.
- Deprecated:
- Since 5.72, use QRandomGenerator::global(). The 1:1 port is bounded(RAND_MAX) but check all the methods that QRandomGenerator provides.
Definition at line 31 of file krandom.cpp.
◆ randomString()
QString KRandom::randomString | ( | int | length | ) |
Generates a random string.
It operates in the range [A-Za-z0-9]
- Parameters
-
length Generate a string of this length.
- Returns
- the random string
Definition at line 58 of file krandom.cpp.
◆ shuffle() [1/2]
template<typename T >
void KRandom::shuffle | ( | T & | container | ) |
◆ shuffle() [2/2]
template<typename T >
void KRandom::shuffle | ( | T & | container, |
QRandomGenerator * | generator | ||
) |
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Dec 6 2023 04:03:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Dec 6 2023 04:03:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.