//
// randRangeWeighted from 0x3d4cbc to 0x3d4d4c (144 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:46:43 +0000
//
int __fastcall randRangeWeighted(float a1, float a2)
{
int v2; // r3
int v5; // r2
float v6; // s17
float v7; // s15
unsigned int v8; // s12
int result; // r0
float v10; // s12
int v11; // [sp+4h] [bp-8h]
v2 = 0;
v5 = (int)a1;
v11 = (int)a1;
while ( (float)v5 <= a2 )
v2 += v5++;
v6 = 1.0 / (float)v2;
v7 = 0.0;
v8 = rand();
result = v11;
v10 = vcvts_n_f32_s32(v8, 0x1Fu);
while ( (float)result <= a2 )
{
v7 = v7 + (float)((float)((float)(a2 + a1) - (float)result) * v6);
if ( v10 <= v7 )
return result;
++result;
}
return v11;
}