Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qrandom.cpp File Reference

(7d44817fc06e2eb4f5ff1fbce8e1905652825c05)

#include "qrandom.h"
#include "qrandom_p.h"
#include <qendian.h>
#include <qmutex.h>
#include <qobjectdefs.h>
#include <errno.h>
#include "qdeadlinetimer.h"
#include "qhashfunctions.h"
#include <qt_windows.h>
#include <assert.h>
+ Include dependency graph for qrandom.cpp:

Go to the source code of this file.

Classes

struct  QRandomGenerator::SystemGenerator
 
struct  QRandomGenerator::SystemAndGlobalGenerators
 
struct  QRandomGenerator::SystemAndGlobalGenerators::ShortenedSystem
 
struct  QRandomGenerator::SystemAndGlobalGenerators::PRNGLocker
 

Macros

#define _CRT_RAND_S
 
#define Q_ASSERT(cond)
 
#define Q_ASSERT_X(cond, x, msg)
 

Enumerations

enum  { FillBufferNoexcept = true , FillBufferNoexcept = true }
 
enum  { FillBufferNoexcept = true , FillBufferNoexcept = true }
 

Functions

DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036 (PVOID RandomBuffer, ULONG RandomBufferLength)
 
static void fallback_update_seed (unsigned value)
 
static Q_NEVER_INLINE void fallback_fill (quint32 *ptr, qsizetype left) noexcept
 
bool operator== (const QRandomGenerator &rng1, const QRandomGenerator &rng2)
 
template<typename Generator, typename FillBufferType, typename T>
static qsizetype callFillBuffer (FillBufferType f, T *v)
 
QRandomGenerator::InitialRandomData qt_initial_random_value ()
 

Variables

static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed = Q_BASIC_ATOMIC_INITIALIZER(0U)
 

Macro Definition Documentation

◆ _CRT_RAND_S

#define _CRT_RAND_S

Definition at line 6 of file qrandom.cpp.

◆ Q_ASSERT

#define Q_ASSERT ( cond)
Value:
assert(cond)
#define assert

Definition at line 47 of file qrandom.cpp.

◆ Q_ASSERT_X

#define Q_ASSERT_X ( cond,
x,
msg )
Value:
assert(cond && msg)

Definition at line 48 of file qrandom.cpp.

Enumeration Type Documentation

◆ anonymous enum [1/2]

anonymous enum
Enumerator
FillBufferNoexcept 
FillBufferNoexcept 

Definition at line 56 of file qrandom.cpp.

◆ anonymous enum [2/2]

anonymous enum
Enumerator
FillBufferNoexcept 
FillBufferNoexcept 

Definition at line 56 of file qrandom.cpp.

Function Documentation

◆ callFillBuffer()

template<typename Generator, typename FillBufferType, typename T>
static qsizetype callFillBuffer ( FillBufferType f,
T * v )
static

Definition at line 1267 of file qrandom.cpp.

◆ fallback_fill()

static Q_NEVER_INLINE void fallback_fill ( quint32 * ptr,
qsizetype left )
staticnoexcept

Definition at line 209 of file qrandom.cpp.

◆ fallback_update_seed()

static void fallback_update_seed ( unsigned value)
static

Definition at line 197 of file qrandom.cpp.

◆ operator==()

bool operator== ( const QRandomGenerator & rng1,
const QRandomGenerator & rng2 )

Definition at line 1220 of file qrandom.cpp.

◆ qt_initial_random_value()

QRandomGenerator::InitialRandomData qt_initial_random_value ( )
noexcept

Returns an initial random value (useful for QHash's global seed). This function attempts to use OS-provided random values to avoid initializing QRandomGenerator::system() and qsimd.cpp.

Note: on some systems, this functionn may rerturn the same value every time it is called.

Definition at line 1288 of file qrandom.cpp.

◆ SystemFunction036()

DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036 ( PVOID RandomBuffer,
ULONG RandomBufferLength )

Variable Documentation

◆ seed

static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed = Q_BASIC_ATOMIC_INITIALIZER(0U)
static

Definition at line 196 of file qrandom.cpp.