random: timer: Use build constant for seed

Use Kconfig symbol for initial seed.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-10-10 10:34:23 -07:00 committed by Johan Hedberg
commit 5fcae0c021

View file

@ -35,7 +35,8 @@ static struct k_spinlock rand32_lock;
*/
uint32_t z_impl_sys_rand32_get(void)
{
static uint64_t state = 123456789UL; /* initial seed value */
/* initial seed value */
static uint64_t state = (uint64_t)CONFIG_TIMER_RANDOM_INITIAL_STATE;
k_spinlock_key_t key = k_spin_lock(&rand32_lock);
state = state + k_cycle_get_32();