//
// std::uniform_int_distribution::operator from 0x59e910 to 0x59e9c2 (178 bytes)
//
// 2 xrefs:
// > std::uniform_int_distribution::operator @ 0x59e97e
// > std::shuffle<__gnu_cxx::__normal_iterator>>,std::linear_congruential_engine> @ 0x59ea16
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
unsigned int __fastcall std::uniform_int_distribution::operator()>(
int a1,
unsigned int *a2,
_DWORD *a3)
{
unsigned int v6; // r4
unsigned int v7; // r4
unsigned int v8; // r8
unsigned int v9; // r4
unsigned int v10; // r0
unsigned int v11; // r0
unsigned int v12; // r3
unsigned int v13; // r8
unsigned int v14; // r0
unsigned int v15; // r0
unsigned int v17; // [sp+4h] [bp-18h]
_DWORD v18[2]; // [sp+Ch] [bp-10h] BYREF
v6 = a3[1] - *a3;
if ( v6 > 0x7FFFFFFC )
{
if ( v6 == 2147483645 )
{
v15 = std::__detail::_Mod::__calc(*a2);
*a2 = v15;
v11 = v15 - 1;
}
else
{
v12 = v6 / 0x7FFFFFFE;
do
{
do
{
v18[1] = v12;
v17 = v12;
v18[0] = 0;
v13 = 2147483646
* std::uniform_int_distribution::operator()>(
a1,
a2,
v18);
v14 = std::__detail::_Mod::__calc(*a2);
v12 = v17;
*a2 = v14;
v11 = v14 - 1 + v13;
}
while ( v11 > v6 );
}
while ( v11 < v13 );
}
}
else
{
v7 = v6 + 1;
v8 = 0x7FFFFFFD / v7;
v9 = v7 * (0x7FFFFFFD / v7);
v10 = *a2;
do
v10 = std::__detail::_Mod::__calc(v10);
while ( v10 - 1 >= v9 );
*a2 = v10;
v11 = (v10 - 1) / v8;
}
return v11 + *a3;
}