feat(random): implement sceRandomGetRandomNumber #8

Merged
Pacuka merged 1 commit from upstream-pr/8 into main 2026-09-26 10:34:24 +00:00
Pacuka commented 2026-09-26 10:14:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-09-26T10:14:55Z.


sceRandomGetRandomNumber was a NotImplemented stub. The Smurfs – Dreams (Unreal Engine) calls it during startup. This PR is the first of the smaller library implementations mentioned in #7.

Changes

  • Fill the buffer from std::random_device.
  • Return SCE_RANDOM_ERROR_INVALID (0x817C0016) for a null buffer or a size above SCE_RANDOM_MAX_SIZE (64), matching the system library, and leave the buffer untouched in that case.
  • Add a guest_random test that covers the invalid arguments, a zero size, partial-word sizes (no write past size), and two 64-byte draws that differ.

Testing (Linux, GCC)

  • The full build and libs build succeed.
  • guest_random passes. ctest: 23/29 pass; the 6 failures are the same pre-existing Linux failures listed in #7.
  • Not tested on Windows.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4646421089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-09-26T10:14:55Z. --- `sceRandomGetRandomNumber` was a `NotImplemented` stub. The Smurfs – Dreams (Unreal Engine) calls it during startup. This PR is the first of the smaller library implementations mentioned in #7. Changes - Fill the buffer from `std::random_device`. - Return `SCE_RANDOM_ERROR_INVALID` (`0x817C0016`) for a null buffer or a size above `SCE_RANDOM_MAX_SIZE` (64), matching the system library, and leave the buffer untouched in that case. - Add a `guest_random` test that covers the invalid arguments, a zero size, partial-word sizes (no write past `size`), and two 64-byte draws that differ. Testing (Linux, GCC) - The full build and libs build succeed. - `guest_random` passes. ctest: 23/29 pass; the 6 failures are the same pre-existing Linux failures listed in #7. - Not tested on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8
No description provided.