#include "core/fxcrt/fx_random.h"
#include <array>
#include "build/build_config.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#define MT_N …
#define MT_M …
#define MT_Matrix_A …
#define MT_Upper_Mask …
#define MT_Lower_Mask …
#if BUILDFLAG(IS_WIN)
#include <wincrypt.h>
#else
#include <sys/time.h>
#include <unistd.h>
#endif
namespace {
struct MTContext { … };
bool g_bHaveGlobalSeed = …;
uint32_t g_nGlobalSeed = …;
#if BUILDFLAG(IS_WIN)
bool GenerateSeedFromCryptoRandom(uint32_t* pSeed) {
HCRYPTPROV hCP = 0;
if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) ||
!hCP) {
return false;
}
::CryptGenRandom(hCP, sizeof(uint32_t), reinterpret_cast<uint8_t*>(pSeed));
::CryptReleaseContext(hCP, 0);
return true;
}
#endif
uint32_t GenerateSeedFromEnvironment() { … }
void* ContextFromNextGlobalSeed() { … }
}
void* FX_Random_MT_Start(uint32_t dwSeed) { … }
uint32_t FX_Random_MT_Generate(void* pContext) { … }
void FX_Random_MT_Close(void* pContext) { … }
void FX_Random_GenerateMT(pdfium::span<uint32_t> pBuffer) { … }