6.0.0-rc4Source

QRandomGenerator64 Class

The QRandomGenerator64 class allows one to obtain 64-bit random values from a high-quality Random Number Generator. More…

Header#include <QRandomGenerator64>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
InheritsQRandomGenerator

List of all members, including inherited members

Public Types

typedefresult_type

Public Functions

QRandomGenerator64(quint32 seedValue = 1)
QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)
QRandomGenerator64(const quint32 (&seedBuffer)[N])
quint64generate()
result_typeoperator()()
voiddiscard(unsigned long long z)

Static Public Members

result_typemin()
result_typemax()
QRandomGenerator64 *system()
QRandomGenerator64 *global()
QRandomGenerator64securelySeeded()

Detailed Description

It is a QRandomGenerator whose generate() and call operator return 64-bit values, so it can feed the standard <random> distributions that need a 64-bit source. All other functions are inherited.

quint64 id = QRandomGenerator64::global()->generate();

See also QRandomGenerator.

Member Type Documentation

typedef QRandomGenerator64::result_type

The type of the values that the generator returns, quint64.

Member Function Documentation

QRandomGenerator64::QRandomGenerator64(quint32 seedValue = 1)

Constructs a generator seeded with seedValue. The same seed always produces the same sequence.

QRandomGenerator64::QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)

This is an overloaded function.

Constructs a generator seeded from the len values at seedBuffer.

template <std::size_t N>QRandomGenerator64::QRandomGenerator64(const quint32 (&seedBuffer)[N])

This is an overloaded function.

Constructs a generator seeded from all N values of seedBuffer.

void QRandomGenerator64::discard(unsigned long long z)

Discards the next z values of the sequence.

quint64 QRandomGenerator64::generate()

Returns a random 64-bit value.

See also bounded().

[static] QRandomGenerator64 * QRandomGenerator64::global()

Returns the process-wide pseudo-random generator, which is seeded once from system(). It is thread-safe but not suitable for cryptographic use.

See also system() and securelySeeded().

[static, constexpr] result_type QRandomGenerator64::max()

Returns the largest value that generate() can return, 0xffffffffffffffff.

See also min().

[static, constexpr] result_type QRandomGenerator64::min()

Returns the smallest value that generate() can return, 0.

See also max().

result_type QRandomGenerator64::operator()()

Returns a random 64-bit value, the same as generate(). This lets the generator be used with the C++ standard library's distributions.

[static] QRandomGenerator64 QRandomGenerator64::securelySeeded()

Returns a new generator that is seeded with random data from system().

See also system() and global().

[static] QRandomGenerator64 * QRandomGenerator64::system()

Returns the process-wide generator that reads from the operating system's random number source. It is cryptographically secure and thread-safe.

See also global() and securelySeeded().