Random Integer (NTDLL)

ULONG CreatePseudoRandomIntegerFromNtdll(_In_ ULONG Seed)
{
	typedef ULONG(NTAPI* RTLUNIFORM)(PULONG);
	RTLUNIFORM RtlUniform = NULL;
	HMODULE hModule = NULL;

	hModule = GetModuleHandleW(L"ntdll.dll");
	if (hModule == NULL)
		return 0;

	RtlUniform = (RTLUNIFORM)GetProcAddress(hModule, "RtlUniform");
	if (!RtlUniform)
		return 0;

	return RtlUniform(&Seed);
}

Last updated