nuttx/libs/libc/stdlib
hanzhijian 9e467388de stdlib/rand: replace weak LCG with xorshift32 PRNG
The existing first-order LCG (seed = 470001 * seed % 999563) has several
quality problems:
- Output range limited to [1, 999562] (~20 bits) instead of full 32-bit
- Lower bits have very short periods (8-bit period = 1, 16-bit = 105)
- Overall period only ~1M, far too short for many applications
- Causes mbedtls_rsa_gen_key to loop forever when rand() consumption
  aligns with the cycle length (issue #16760)

Replace the entire order-based LCG implementation (CONFIG_LIBC_RAND_ORDER
0-3) with Marsaglia's xorshift32:
- Full 32-bit output range
- Period 2^32 - 1 (~4.29 billion)
- Fast: just three XOR/shift operations
- No floating-point math needed
- No CONFIG_LIBC_RAND_ORDER configuration required

Remove the CONFIG_LIBC_RAND_ORDER Kconfig option and clean up all
defconfig references (12 boards) and related comments.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-07-03 15:08:12 +08:00
..
CMakeLists.txt libc: improve libc dependencies in case of LIBM_NONE 2025-12-14 17:57:27 -03:00
Kconfig stdlib/rand: replace weak LCG with xorshift32 PRNG 2026-07-03 15:08:12 +08:00
lib_abort.c
lib_abs.c
lib_aligned_alloc.c libc: remove reference to non-existent readme 2025-10-11 17:07:51 -04:00
lib_arc4random.c
lib_atexit.c
lib_atof.c
lib_atoi.c libc: remove reference to non-existent readme 2025-10-11 17:07:51 -04:00
lib_atol.c libc: remove reference to non-existent readme 2025-10-11 17:07:51 -04:00
lib_atoll.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_bsearch.c
lib_checkbase.c
lib_div.c
lib_exit.c
lib_getprogname.c
lib_itoa.c
lib_labs.c
lib_ldiv.c
lib_llabs.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_lldiv.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_mblen.c
lib_mbstowcs.c
lib_mbtowc.c
lib_mkdtemp.c
lib_mkstemp.c
lib_mktemp.c
lib_openpty.c
lib_posix_memalign.c libc: remove reference to non-existent readme 2025-10-11 17:07:51 -04:00
lib_ptsname.c
lib_ptsnamer.c
lib_qsort.c
lib_rand.c
lib_rand48.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_reallocarray.c
lib_realpath.c
lib_srand.c stdlib/rand: replace weak LCG with xorshift32 PRNG 2026-07-03 15:08:12 +08:00
lib_strtol.c
lib_strtold.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_strtoll.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_strtoul.c
lib_strtoull.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_unlockpt.c
lib_valloc.c libc: remove reference to non-existent readme 2025-10-11 17:07:51 -04:00
lib_wcstombs.c
lib_wctomb.c
Make.defs libc: improve libc dependencies in case of LIBM_NONE 2025-12-14 17:57:27 -03:00