Do you have example code? I think I was able to reproduce the issue you're describing.
I believe the "problem" is that the random number generator's seed doesn't change between runs of the emulator.
Here's my test:
import random
import time
l = [0,1,2,3]
for i in range(20):
r = random.choice(l)
print(f"{i}: {r}")
# Outputs:
# 0: 1
# 1: 0
# 2: 1
# 3: 3
# 4: 0
# 5: 3
# 6: 3
# 7: 3
# 8: 1
# 9: 1
# 10: 3
# 11: 3
# 12: 3
# 13: 1
# 14: 1
# 15: 2
# 16: 1
# 17: 2
# 18: 3
# 19: 1
The output is the same each time.
Relevant documentation:
https://docs.micropython.org/en/latest/library/random.html?highlight=random#random.seedSome usual tricks for initializing a seed for less deterministic results is passing in the time, but because the emulator has no true Real Time Clock(RTC) or this MICROPY_PY_URANDOM_SEED_INIT_FUNC setting enabled, all the random number functions will act deterministically.
In practice, you might be fine with passing the time.ticks_ms() or time.ticks_us() as the seed (
https://docs.micropython.org/en/latest/library/time.html?highlight=time#time.ticks_ms):
import random
import time
random.seed(time.ticks_us()) # Relies on minor inconsistencies to differ a little each time
l = [0,1,2,3]
for i in range(20):
r = random.choice(l)
print(f"{i}: {r}")
It's not great and depending on how early on in the execution you're getting random numbers, it might get the same seed more often than not.
EDIT: I'm just stating what appears to be happening in the emulator. I don't know if the actual hardware will implement the micropython option or at least have working RTC so we can have some source of noise. Maybe the engineers/devs can answer?