Pages: 1 [2]   Go Down
Author Topic: Using an Arduino to process white noise into Random Numbers  (Read 4433 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Shannon Member
****
Karma: 159
Posts: 10409
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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!
Logged

[ I won't respond to messages, use the forum please ]

Pages: 1 [2]   Go Up
Jump to: