Doesn't the block hash or the transaction id provide enough entropy
(for example, by using block_hash % 37
to generate a random number between 0 and 36)?
Block Chain Roulette determines the lucky number as a function of the hash of newest block in the chain:
Everytime a new block is created on the Bitcoin block chain, the roulette wheel is spun and a random number between 0 and 36 is generated...
random hash = hmac_sha512(secret hash, block hash)
... the random decimal integer is then multiplied by 37 and divided by (72057594037927935 + 1), decimal places dropped, resulting in a number between 0 and 36. 14 hex charecters are used because this represents a maximum random number of 72057594037927935, a number which is divisable equally by 37 (Or at least very very close to being equally divisable, when working with such large numbers). This ensures each number between 0 and 36 has an equal probability of being chosen. Continue reading...
SatoshiDice determines win/lose by using a pre-determined secret as well:
The lucky number used to determine the winner of games is simple. It is simply the first bytes of
hmac_sha512(secert,txid:out_idx)
. That would be the secret string as the key and the transaction ID of your bet transaction as the data.
Can someone generate a transaction in such a way that its hash is known ahead of time?
Edit: It seems like the second part of the question has already been answered.