//
// GameToolbox::gen_random from 0x6a8718 to 0x6a890c (500 bytes)
//
// 3 xrefs:
// > GJGameLevel::generateAutoSaveUID @ 0x83bfc0
// > GJMultiplayerManager::uploadComment @ 0xac6fc8
// > ??> @ 0xbad00
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:50:46 +0000
//
__int64 *__usercall GameToolbox::gen_random@(GameToolbox *this@, __int64 *a2@)
{
int v2; // w22
unsigned __int8 v4; // w1
int i; // w20
unsigned int v6; // w1
unsigned int v8; // w0
__int64 *v9; // x2
__int64 v10; // x1
__int64 v11; // x20
__int64 v12[2]; // [xsp+58h] [xbp+58h] BYREF
void *v13; // [xsp+68h] [xbp+68h]
__int64 v14[9]; // [xsp+70h] [xbp+70h] BYREF
v2 = (int)this;
v4 = atomic_load((unsigned __int8 *)&byte_155AA90);
if ( (v4 & 1) == 0 )
{
if ( _cxa_guard_acquire((__guard *)&byte_155AA90) )
{
v12[0] = 0;
v12[1] = 0;
v13 = nullptr;
std::string::__init(v12, "/dev/urandom", 0xCu);
std::random_device::random_device(v14, v12);
v8 = std::random_device::operator()(v14);
v9 = &qword_155AA98;
v10 = 1;
qword_155AA98 = v8;
do
{
v11 = (unsigned int)v10++ + 1812433253 * ((unsigned int)*v9 ^ (unsigned int)((unsigned __int64)*v9 >> 30));
v9[1] = v11;
++v9;
}
while ( v10 != 624 );
qword_155BE18 = 0;
_cxa_guard_release((__guard *)&byte_155AA90);
std::random_device::~random_device((std::random_device *)v14);
if ( (v12[0] & 1) != 0 )
operator delete(v13);
}
}
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
std::string::reserve(a2, v2);
if ( v2 > 0 )
{
for ( i = 0; i != v2; ++i )
{
std::__independent_bits_engine,unsigned int>::__independent_bits_engine(
v14,
(__int64)&qword_155AA98,
6u);
do
v6 = std::__independent_bits_engine,unsigned int>::__eval(v14);
while ( v6 > 0x3D );
std::string::push_back(a2, a0123456789abcd_2[v6]);
}
}
return a2;
}