mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 04:38:59 +00:00
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> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Kconfig | ||
| lib_abort.c | ||
| lib_abs.c | ||
| lib_aligned_alloc.c | ||
| lib_arc4random.c | ||
| lib_atexit.c | ||
| lib_atof.c | ||
| lib_atoi.c | ||
| lib_atol.c | ||
| lib_atoll.c | ||
| 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 | ||
| lib_lldiv.c | ||
| 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 | ||
| lib_ptsname.c | ||
| lib_ptsnamer.c | ||
| lib_qsort.c | ||
| lib_rand.c | ||
| lib_rand48.c | ||
| lib_reallocarray.c | ||
| lib_realpath.c | ||
| lib_srand.c | ||
| lib_strtol.c | ||
| lib_strtold.c | ||
| lib_strtoll.c | ||
| lib_strtoul.c | ||
| lib_strtoull.c | ||
| lib_unlockpt.c | ||
| lib_valloc.c | ||
| lib_wcstombs.c | ||
| lib_wctomb.c | ||
| Make.defs | ||