STC icon indicating copy to clipboard operation
STC copied to clipboard

crand and crand_u64 generating same number multiple time consecutively

Open Omegaki113r opened this issue 1 year ago • 0 comments

Hi, First of all thanks for this amazing library.

I mainly work on embedded side of things specially on ESP32 MCUs (Xtensa architecture). I needed to generate 64-bit random numbers therefore i started using crandom api for that.

But for some reason it generates the same number if i try to generate random numbers.

i tried both methods.

  1. csrand(time(NULL)) then crand() to generate numbers
  2. crand_t r = crand_init(time(NULL)) then crand_u64(&r)

both methods behave in the same way. Not sure this is something coming from the bug of ESPIDF toolchain and compiler or from the STC crandom API as well.

any suggestions or insight about what could be wrong here?

Omegaki113r avatar Jun 03 '24 20:06 Omegaki113r