according to this link about etherdice, the game needs both players provide a seed and combine them together as the input of a RNG(random number generator) to generate the dice number, but one problem is that the second player to upload the seed can have the ability to manipulate the output(I mean if the player knows about the RNG aogorithm, then he can search the seed space to find the one that benefit him), then how does the etherdice fix this problem?
The reason that this system is secure is that the two players must submit the hash of their random seeds before any betting takes place.
This is called non-malleable commitment, and it ensures that the players cannot change their seeds after they see all of the bets.
The inclusion of the blockhash, number, and timestamp is to ensure that even if the two seeders are colluding, they still can't affect the outcome unless they are also colluding with the miners.
There are still attack vectors, however. If the second person to reveal their seed does not like the outcome, they can choose not to reveal, and all of the money is refunded. This means they can take as many shots at the jackpot as they like, almost for free. This risk is low, however, since the operator of the site is that second person, so their reputation is at stake.
The site is provably fair, as long as the operator of the site is not colluding with the miners, which is a pretty big if...
For a totally decentralized, if less convinient version, see How can I securely generate a random number in my smart contract?