random: add xoshiro128++ PRNG source
Adds an implementation of xoshiro128++ as a pseudo random number generator from https://prng.di.unimi.it/ that operates on 32bit words. The algorithm postfix signifies the main operation in the generation function. Therefore xoshiro++ is chosen over xoshiro** as we would prefer to do 2 additions isntead of 2 multiplications on embedded hardware. The quality of the generators appears to be the same in all other respects. xoshiro+ is not chosen despite being faster as it generates random floating-point values, not general purpose random values (The lower 4 bits are linear). Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
365ff6db9f
commit
688fc737a8
3 changed files with 127 additions and 2 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR
|
||||
CONFIG_TIMER_RANDOM_GENERATOR OR
|
||||
CONFIG_XOROSHIRO_RANDOM_GENERATOR)
|
||||
CONFIG_XOROSHIRO_RANDOM_GENERATOR OR
|
||||
CONFIG_XOSHIRO_RANDOM_GENERATOR)
|
||||
zephyr_library()
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE rand32_handlers.c)
|
||||
endif()
|
||||
|
@ -16,7 +17,8 @@ endif()
|
|||
|
||||
zephyr_library_sources_ifdef(CONFIG_TIMER_RANDOM_GENERATOR rand32_timer.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoroshiro128.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CTR_DRBG_CSPRNG_GENERATOR rand32_ctr_drbg.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_XOSHIRO_RANDOM_GENERATOR rand32_xoshiro128.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CTR_DRBG_CSPRNG_GENERATOR rand32_ctr_drbg.c)
|
||||
|
||||
if (CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR OR CONFIG_HARDWARE_DEVICE_CS_GENERATOR)
|
||||
zephyr_library_sources(rand32_entropy_device.c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue