Truly Random Numbers

Truly Random Numbers
« on: July 09, 2018, 10:19:22 PM »
Has anyone figured how to create truly random numbers with the TinyArcade?

Per the tutorial (https://tinycircuits.com/blogs/learn/how-to-develop-a-game-for-the-tinyarcade-new), I checked the Arduino reference at https://www.arduino.cc/reference/en/language/functions/random-numbers/randomseed/

But pin 0 seems to be in use by the TinyArcade. The joystick does not work properly. I looked at the TinyArcade manual and it seems all pins are used. Or isn't it?

Any help will be really appreciated. Thanks!

Re: Truly Random Numbers
« Reply #1 on: July 10, 2018, 05:34:00 AM »
I haven't deeply looked into it yet but will need that too...
My current approach is to use analogRead(0)+analogRead(1)+millis().

My only idea for now was to change millis() for micros(), but in my case I set the seed in setup().
And since it should take exactly the same amount of cycles each time I fear my random will not be very random :/


Re: Truly Random Numbers
« Reply #2 on: July 10, 2018, 02:33:03 PM »
Hi John,

If you'd like to follow the guide on the link you posted, you're in luck because several pins on the Tiny Arcade are unused. The following are the unused pins on the main Tiny Arcade board: 1, 2, 8-12, 14-16, 29-32, 37, 38

I hope this helps. Let us know!


Re: Truly Random Numbers
« Reply #3 on: July 11, 2018, 01:34:08 AM »
Fantastic Hunter, thank you! I used 8 and the seed worked great.