Many online Bitcoin gambling websites use the block chain info to prove fairness. Most of them use rather complex algorithms for this with pre-published secrets.
What most of them basically achieve: Convert a block hash or a transaction hash to a number in a certain range.
What is the simplest way to do this in a fair way, verifiable by everyone? I would like to focus mostly on using block hashes, which are the least manipulable.
With a simple way I'm looking for either a very simple mathematic way to do so or either a library which can do it for you.
I understand that predefined secrets are required when transaction information is used, because these are easy for users to manipulate. Block information, on the other hand, is far less easy manipulable. If you want to generate a block with a hash that would make you win in the game, you would make the standard block generation problem even more difficult and you will have to do solo mining which is already quite hard when doing regular mining. So, are these secrets also required when using block information?
Note that I am an engineering student myself so I will probably understand much cryptographic and mathematical terms, but the purpose of this question is of course to receive an answer that everyone can understand.