Go Down

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

MarkT

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 won't respond to messages, 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!

Arduino
via Egeo 16
Torino, 10131
Italy