It does remind one of "What have I got in my pocket?", doesn't it? In the Hobbit, Bilbo and Gollum agree that, since it isn't an entirely proper riddle, Gollum will get three guesses.
It seems that Samson and his potential in-laws agreed to a similar solution. Reading on:
And in three days they could not solve the riddle.
On the fourth day they said to Samson's wife, “Entice your husband to tell us what the riddle is, lest we burn you and your father's house with fire. Have you invited us here to impoverish us?” And Samson's wife wept over him and said, “You only hate me; you do not love me. You have put a riddle to my people, and you have not told me what it is.” And he said to her, “Behold, I have not told my father nor my mother, and shall I tell you?” She wept before him the seven days that their feast lasted, and on the seventh day he told her, because she pressed him hard. Then she told the riddle to her people.—Judges 14:14b–17 (ESV)
In other words, the young men had the entire seven days of the feast to solve the riddle. Presumably, they were allowed to make as many wrong guesses as they liked within that time and as long as they never made a correct guess Samson would win the riddle contest.
Since the text doesn't lay out the rules in detail, this form of riddle that did not contain enough clues to be solved in one guess must have been common practice. One hint we read is:
His father went down to the woman, and Samson prepared a feast there, for so the young men used to do.—Judges 14:10 (ESV)
It's speculation, but I wonder if the telling of riddles was a local tradition along the lines of tossing a garter or the kings' cake. In other words, a fairly meaningless tradition that people engage in to break the ice and pass the time. But it turned sour in Samson's case:
And the Spirit of the LORD rushed upon him, and he went down to Ashkelon and struck down thirty men of the town and took their spoil and gave the garments to those who had told the riddle. In hot anger he went back to his father's house. And Samson's wife was given to his companion, who had been his best man.—Judges 14:19-20 (ESV)