sys/random: default to musl LCG

In [0] the paper concludes with

> The Knuth LCG is the most efficient general purpose generator that
> provides decent statistical quality.
> It is simple and lean enough to run on very constrained devices.

So let's select `prng_musl_lcg` to be the default PRNG instead of
`prng_tinymt32`.

This gives a good chunk of memory on e.g. `samr21-xpro`:

prng_tinymt32
-------------

   text	   data	    bss	    dec	    hex	filename
  26452	    136	   2824	  29412	   72e4	tests/rng/bin/samr21-xpro/tests_rng.elf

prng_musl_lcg
-------------

   text	   data	    bss	    dec	    hex	filename
  26208	    136	   2808	  29152	   71e0	tests/rng/bin/samr21-xpro/tests_rng.elf

[0] https://sci-hub.se/10.1145/3453159
This commit is contained in:
Benjamin Valentin 2021-11-11 19:59:26 +01:00
parent a85853ae30
commit 39b8cdf760
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ endif
ifneq (,$(filter random,$(USEMODULE)))
# select default prng if no prng is selected
ifeq (,$(filter prng_%,$(USEMODULE)))
USEMODULE += prng_tinymt32
USEMODULE += prng_musl_lcg
endif
endif

View File

@ -17,7 +17,7 @@ choice RANDOM_IMPLEMENTATION
bool "PRNG Implementation"
depends on TEST_KCONFIG
default MODULE_PRNG_HWRNG if HAS_PERIPH_HWRNG
default MODULE_PRNG_TINYMT32
default MODULE_PRNG_MUSL_LCG
menuconfig MODULE_PRNG_FORTUNA
bool "Fortuna"