Merge remote-tracking branch 'origin/splitmix32-random' into integration

This commit is contained in:
J. Nick Koston
2026-03-19 14:45:46 -10:00
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -122,6 +122,8 @@ def zephyr_to_code(config: ConfigType) -> None:
zephyr_add_prj_conf("FPU", True)
zephyr_add_prj_conf("NEWLIB_LIBC_FLOAT_PRINTF", True)
zephyr_add_prj_conf("STD_CPP20", True)
# random_bytes() uses sys_rand_get() which requires the entropy subsystem
zephyr_add_prj_conf("ENTROPY_GENERATOR", True)
# <err> os: ***** USAGE FAULT *****
# <err> os: Illegal load of EXC_RETURN into PC
+1
View File
@@ -172,6 +172,7 @@ uint32_t random_uint32() {
// a separate bool flag (4 bytes BSS + branch on every call).
if (splitmix32_state == 0) {
random_bytes(reinterpret_cast<uint8_t *>(&splitmix32_state), sizeof(splitmix32_state));
splitmix32_state |= 1; // ensure non-zero seed
}
splitmix32_state += 0x9e3779b9u;
uint32_t z = splitmix32_state;