mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 20:59:02 +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>
50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
#
|
|
# For a description of the syntax of this configuration file,
|
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
#
|
|
|
|
menu "stdlib Options"
|
|
|
|
config LIBC_HOMEDIR
|
|
string "Home directory"
|
|
default "/"
|
|
---help---
|
|
The home directory to use with operations like such as 'cd ~'
|
|
|
|
config LIBC_TMPDIR
|
|
string "Temporary file directory"
|
|
default "/tmp"
|
|
---help---
|
|
If a write-able file system is selected, this string will be
|
|
provided to specify the full path to a directory where temporary
|
|
files can be created. This would be a good application of RAM disk:
|
|
To provide temporary storage for application data.
|
|
|
|
config LIBC_MAX_TMPFILE
|
|
int "Maximum size of a temporary file path"
|
|
default 32
|
|
---help---
|
|
If a write-able file system is selected, then temporary file may be
|
|
supported at the path provided by LIBC_TMPDIR. The tmpnam() interface
|
|
keeps a static copy of this last filename produced; this value is the
|
|
maximum size of that last filename. This size is the size of the full
|
|
file path.
|
|
|
|
config LIBC_MAX_EXITFUNS
|
|
int "Maximum amount of exit functions"
|
|
default 0
|
|
---help---
|
|
Configure the amount of exit functions for atexit/on_exit. The ANSI
|
|
default is 32, but most likely we don't need as many.
|
|
|
|
config LIBC_DISABLE_HEXSTR_TO_FLOAT
|
|
bool "Disable hex-string to float/double conversions"
|
|
default DEFAULT_SMALL
|
|
---help---
|
|
Disables parsing of hexadecimal floating-point constants (C99 %a),
|
|
e.g., "0x1.fp3", in strtod(), strtof(), strtold(), and sscanf("%a").
|
|
This saves flash space since hex-float parsing adds significant code
|
|
and is rarely needed in embedded systems. Decimal float parsing remains
|
|
available.
|
|
|
|
endmenu # stdlib Options
|