Random Number Seed | Entropy | Xiao

Hi,

I’m looking for a good way of seeding the random number generator on a Xiao. On other Arduino based projects I use the Entropy code written by Walter Anderson. This fails to compile for the Xiao with the error:

Entropy.cpp:92:3: error: ‘ATOMIC_BLOCK’ was not declared in this scope

ATOMIC_BLOCK(ATOMIC_RESTORESTATE)

Other suggestions are to perform an analogue read on a floating analogue pin but I’m using all the pins on the Xiao so that’s a little difficult!

I was wondering if there is an easy fix for the above error, or a better way of seeding the random number generator?

Many thanks

Martin

https://gist.github.com/bloc97/b55f684d17edd8f50df8e918cbc00f94 @G0PJO is work for you ?