feat(libc): implement erand48, nrand48 and jrand48 #3424
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3424"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T10:09:04Z.
What
erand48(Fncgcl1tnXg),nrand48(3wcYIMz8LUo) andjrand48(M7KmRg9CERk) fromlibSceLibcInternal. Nothing in the tree implements the rand48 family yet.VLC (PPSA85300) stops on
erand48onmainc6ca798f, as @babyhuey reported in #1578 (Linux, catalog build withsce_module/libc.prxunwrapped as #2605 requires):With this branch, VLC goes on to
sigtimedwait(D2-dIoJ0ZtE). VLC imports all three.They implement the POSIX 48-bit generator
X = (0x5DEECE66D * X + 0xB) mod 2^48on the caller'sunsigned short[3], which is updated in place (FreeBSD's_dorand48arithmetic):erand48returnsX / 2^48;nrand48returns bits 47..17;jrand48returns bits 47..16 as a signed 32-bit value.A null seed throws.
guest_random_statechecks:srand48(0x1234ABCD)state, including a negativejrand48(a mutant without the sign cast fails);erand48/nrand48/jrand48.Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain24cb0d24:guest_random_statepasses 5/5. Without the change it doesn't link, and the sign-cast mutant fails it.ctest -E "^agc_|video_out": 442/445. The three failures fail onmaintoo:windows_exceptions(#3411),guest_process_time_scaledunder-j8(#3414) andguest_ampr_markers. None touch the code changed here.agc_unit_shadow, also fails onmain(#3215).guest_random_state5/5 on Linux with VLC (#1578).check_conventions.pypasses, andpr_overlap.pyreports no overlap.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T10:09:29Z.
Progress report (
3bf63fa→f85ae8d)📈 System libraries: 85.75% (+0.01%, +3 implemented functions)
✅ 3 implemented
erand48_nid_postfixjrand48_nid_postfixnrand48_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:21:00Z.
Checked the diff, built and ran
guest_random_stateon Linux: passes, and it fails to link without the change. The arithmetic matches FreeBSD's_dorand48and the test cross-checks glibc over 64 rounds; merging once CI is green.