This statement of the puzzle comes from Wikipedia. There are subtle variations, but only one puzzle.

Three gods A, B, and C are called, in some order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a random matter. Your task is to determine the identities of A, B, and C by asking three yes-no questions; each question must be put to exactly one god. The gods understand English, but will answer all questions in their own language, in which the words for yes and no are ‘da’ and ‘ja’ but you do not know which word means which.

You are free to ask any questions of any gods in any order to a total maximum of 3 questions. You may only ask questions that True and False can answer. For the purposes of this puzzle the Random god should be thought of as answering entirely at random with no regard for the content of the question. Differing interpretations of Random are responsible for some variations in the puzzle.

Solution over the fold.
The three questions proceed as follows.

  1. To God A ask: “If I asked you ‘Is God B called Random?’, would you say ‘ja’?”.
  2. If the answer is ‘ja’ choose God C for the next question, else choose God B.
  3. To that God ask: “If I asked you ‘Are you called True?’ would you say ‘ja’?”
  4. If the answer is ‘ja’ then that god is called True else False.
  5. To that same God ask: “If I asked you ‘Is God A called Random?’ would you say ‘ja’?”
  6. If the answer is ‘ja’ then God A is called Random else whichever is left of the other two (True or False).
  7. The remaining God is called whatever is left.

The particular form of question is called a counterfactual. As long as it is asked of a God who is either True or False, then an answer of ‘ja’ means the quoted question is true else false. If asked of Random the answer is random.

For the first question, if God A is True or False then ‘ja’ means God B is Random, and ‘da’ means God C is Random. If God A is Random then (obviously) Gods B and C are not, regardless of the answer. Thus ‘ja’ means God C is not Random and ‘da’ means God B is not Random, in all cases. The remaining questions are directed to the non Random god.

For the second question ‘ja’ means that this non Random god is in fact True otherwise False. For the third question ‘ja’ means that God A is Random otherwise whatever is left. The name of the remaining god is deduced by simple elimination.

Variation 1 : Random is taken as choosing at random between answering as True or False
In this case counterfactuals of this form cannot be used. Random simply does not know what answer to give, because the quoted question would be answered at random! However, the following form may be used.

To any God ask: “If I asked you ‘Are you called X?’ and you answered it in the same True/False state as you are now answering this question, would you say ‘ja’?”

For any god including Random an answer of ‘ja’ means the quoted question is true otherwise false. Two or at most three questions are enough to trivially determine the names of all gods.

Variation 2 : As above, but unanswerable questions are permitted
Assume that unanswerable questions are met with silence, while answers are otherwise given immediately. The solution is to use the same first question as in the main solution. An answer of ‘ja’ means God B is Random, ‘da’ means God C is Random and silence means God A is Random. One further simple question pins down the other two gods.