From e763cb8e998992a46fe0290eded5af5418f7597f Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Sun, 12 Feb 2023 10:51:08 -0600 Subject: [PATCH] Fix typo in pico_rand breaking randomness when PICO_RAND_ENTROPY_SRC_BUS_PERF_COUNTER=1 (#1246) --- src/rp2_common/pico_rand/rand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rp2_common/pico_rand/rand.c b/src/rp2_common/pico_rand/rand.c index 0d1c6c5d..e1cde58e 100644 --- a/src/rp2_common/pico_rand/rand.c +++ b/src/rp2_common/pico_rand/rand.c @@ -272,7 +272,7 @@ uint64_t get_rand_64(void) { if (bus_counter_value == BUSCTRL_PERFCTR0_BITS) { bus_ctrl_hw->counter[bus_counter_idx].value = 0; } - local_rng_state.r[which] &= splitmix64(bus_counter_value); + local_rng_state.r[which] ^= splitmix64(bus_counter_value); which ^= 1; #endif