Go Down

Topic: Using an Arduino to process white noise into Random Numbers (Read 7452 times) previous topic - next topic


Code: [Select]
uint32_t getRandomUL()
  uint32_t x = 0;
  for (uint8_t i = 0; i < 32; i++)
    x |= ((analogRead(A0) & 0x01) << i);

is never going to return random(*) values, just junk off the stack.

Perhaps you meant to "return x;" ?

(*) OK, junk off the stack can look random, but we want somewhat more random than that here!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131