Wrote a frequency test - change loop() in program above shows that on my UNO there are four numbers - 0, 13, 26, 39 - are more preferred than others. The others are more distributed evenly. So it is definitely not as random as I would like it to be, but very interesting why.
Hypothesis: Think it is because the same sensor is read out in a tight loop and the noise bit fluctuates not fast enough, resulting in similar noise bits => the bits are not random enough (entropy/randomness).
in other words the readings are "too stable".
void loop()
{
for (int i=1; i< 25; i++) frequency_test(40);
}
void frequency_test(int mx)
{
int nr[40];
for(int i = 0; i < 40; i++) nr[i] = 0;
for(int i = 0; i < 1000; i++) nr[ randomRange(0, mx)] ++;
Serial.println();
Serial.println(mx);
Serial.println("=======================");
for(int i = 0; i < 40; i++)
{
Serial.print(i);
Serial.print("\t");
Serial.print(nr[i]);;
Serial.print("\t");
for (int x=0; x < nr[i]; x++) Serial.print("]");
Serial.println();
}
}
output sample
40
=======================
0 36 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
1 31 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
2 29 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
3 24 ]]]]]]]]]]]]]]]]]]]]]]]]
4 24 ]]]]]]]]]]]]]]]]]]]]]]]]
5 21 ]]]]]]]]]]]]]]]]]]]]]
6 27 ]]]]]]]]]]]]]]]]]]]]]]]]]]]
7 19 ]]]]]]]]]]]]]]]]]]]
8 21 ]]]]]]]]]]]]]]]]]]]]]
9 34 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
10 13 ]]]]]]]]]]]]]
11 23 ]]]]]]]]]]]]]]]]]]]]]]]
12 21 ]]]]]]]]]]]]]]]]]]]]]
13 43 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
14 30 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
15 16 ]]]]]]]]]]]]]]]]
16 18 ]]]]]]]]]]]]]]]]]]
17 26 ]]]]]]]]]]]]]]]]]]]]]]]]]]
18 11 ]]]]]]]]]]]
19 30 ]]]]]]]]]]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