Hi,
I notice by using urandom module that the values are always the same after a reboot with random(), randint() ...
For example, after a reset, the results after many consecutive urandom.random() instructions are always :
0.7111824
0.4089468
0.09752237
Is someone notice it? Is it normal?
Thanks
urandom, always same values after reset
Re: urandom, always same values after reset
See https://github.com/micropython/micropython/issues/6347 and https://github.com/micropython/micropython/pull/6558
In summary -- it always used the same default seed (it's a pseudorandom generator, so it's not designed for cryptographic use). The behavior was updated in 1.14 to use a HW random source if available.
In general though, if you're using random it's a good idea to explicitly seed it in a way that is appropriate for your use case.
Re: urandom, always same values after reset
Hi @jimmo,
thanks for your reply, it's clear!
Iuse V1.13, I have to upgrade to V1.14.
thanks for your reply, it's clear!
Iuse V1.13, I have to upgrade to V1.14.