Isolated ATMEGA microcontroller

Good Evening Everyone,

I have a programme that generates a question that always has answer between 1 and 7, 4 questions need to be answered in order for the game to finish. I have taken out the microcontroller out of the Arduino board and made my own. The programme work perfectly its just that every time I start the game the same question sequence comes up. i.e. 10-9 4-3 0+7 8-4 I need the question to be random upon startup could anyone please help?
Thank you

main.ino (3.75 KB)

Seed it with something that has some entropy - got any floating analog pins you can read or something? You need some source of randomness - and the ADC is about the one available on an Arduino board.

it works properly on the arduino board (random questions come on at startup) but not on PCB.

Well, it absolutely should not!

random() should give the same set of numbers every time the sketch is run, unless you seed it with something that varies. This is typical of software random number generators.

Sir, I have no idea how to do this. :confused: Would it extend the script a lot?

If this is a simple change can someone please just add it on and explain what I need to alter on my PCB? Thank you

Just do randomSeed(analogRead(pin)) in setup, where the pin is a floating (not connected to anything) analog pin

Possibly better way: forget random() and use the user as source of randomness. Let user do anything to get first question (i.e. "Welcome, press any button") and then you may use millis() to get "random" number.

Thank you guys it works!!!! Thank you