By random, I mean not predictable. I ask because SatoshiDice takes the hash of a txid. Would it be possible for someone to calculate the id (or part of an ID) before sending? Why doesn't SD just use the txid?
You can fabricate a transaction ID, so there is no guarantee that the transaction id is random.
The reason it doesn't matter to SatoshiDICE is because the bettor doesn't know the secret used in determining the resulting answer (a number, from zero to 65,535). If just one bit to the transaction ID is different from another, the resulting answer ends up being a totally different number that is random(ish)ly generated.
At the end of each day, the daily secret that was used can be safely revealed, providing a method for the bettor (or anyone else) to verify the that each bet was addressed fairly.
Here's a thread addressing the use of SHA hashing as random number generation:
-
http://bitcointalk.org/index.php?topic=77206.0