I created this question on our Bitcoin StackExchange but since it is far less populated that this forum, I ask it here as well.
http://bitcoin.stackexchange.com/questions/9074/how-to-use-block-and-transaction-hashes-for-generating-simple-stochastic-chancesBecause I think that new users will be more likely to use the StackExchange as a source of information, I suggest that you place your answer on the StackExchange post. If you prefer not to, I will copy your answer here to the question as a Community Wiki answer so that everyone can help improve it.
I'm trying to implement something similar myself and I do not really understand when predefined secrets are required.
But, generally, I made this question because I could not find a clear explanation of the mechanism apart from the specific ones from several sites, but those were quite difficult to understand.