HI,
I’m trying to use the randomSeed(analogRead(0)); function to randomly generate numbers between 1 and 3. However, despite following the Arduino example using the randNumber variable, I get the same exact numbers almost every single time. Here is an example of what I get on the serial monitor:
1
2
1
1
2
2
3
3
3
3
3
3
2
1
1
etc.
It doesn’t matter if I put delays in the code between readings or if I lengthen or shorten the delays, there is nothing connected to the analog A0 pin, and to make matters more mysterious, if i use while loops to keep the function from progressing until it generates a new number, it keeps generating the same numbers anyway. If I use If conditions to make sure the new number generated doesn’t match the previous number generated, it ignores the If statements too, and continues to print the same numbers. Is randomSeed a viable random number generator function, or should I drop it for another one? Thanks for any input on this.