Solving the 100 prisoners problem

This is an excellent way to get your brain engine working today! Comment your thoughts about this riddle or post your solution.

Light bulb100 people are being held prisoner in a jail. They are told that in one hour, they will all be taken to separate windowless, soundproof cells. One at a time, and in a random order, they will be taken from their cells, interrogated, and then sent back to their cells.

All interrogations will take place in the same room, which contains one light bulb and the switch that operates it. The prisoners do not know whether the light will be initially on or off, but the inmates are free to toggle the switch as often as they want, whenever they are in the interrogation room, and the prison guards will not toggle the switch at all.

No prisoner can see the light from his cell. Only one prisoner is interrogated at a time, each prisoner can be interrogated multiple times, and they have no way of communicating besides the light switch. The length and amount of time between interrogations is random, so no help there.

At any time, any prisoner under interrogation may state, “Everyone has been interrogated at least once.” If this statement is true, everyone will be released. If it is false, all of the prisoners will be executed.

The prisoners have one hour to work out their strategy before they’re isolated for good. How do they get released?

Do you think you know the answer? Comment below and help us solve the 100 prisoners problem!