benilla-re systems structs docs

RandomUnitVector2

function · random · primitive

Address
0x44fd00 · 284 bytes, up to 0x44fe1b
Signature
void __fastcall (float *out, NTempest::CRndSeed *seed)
Meaning
Writes (cos a, sin a), a = 2π·u from one inlined advance
Confidence
verified, proof one
Finding
random#unit-vectors
Test
random::rand_44fd00_gradient

Finding: Unit vectors in random

0x44fd00 advances a state once, takes the accumulator's low 23 bits as the mantissa of a float m in [1, 2), and writes (cos a, sin a) as floats, where a = (m − 1)·2π rounded to a float. 0x44fe20 advances twice: the first value gives z = m − 2 when the accumulator is non-negative as an int32 and z = 2 − m when it is negative; the second gives the angle a as above. It writes (cos a · r, sin a · r, z) with r = √(1 − z²) stored as a float. Both take the output pointer in ecx and the state in edx.

The derivation is in the doc.

Callers 2

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.