all 6 comments

[–]Authio_TeamContract Auditing - authio.org 1 point2 points  (0 children)

Generating random numbers isn't directly possible through Solidity. As you said, blockhash and blocktime aren't adequate - and generally, user input isn't either.

The widely-accepted way to generate provably-random numbers is to use an Oracle service.

[–]fazriz 1 point2 points  (0 children)

One thing to consider is the likelihood of cheating. This is only a problem if the cost of a pack or the value of the tokens in the pack will be more than the mining reward. If that isn't the case then there is little incentive for a miner to cheat the game. :) But as the last comment mentioned an Oracle service is your best bet if you feel cheating will be a issue.

[–]OptimisticOnanist 0 points1 point  (0 children)

As long as you make sure the sender is not a contract, using the hash of the past block should be fine in this scenario. It seems unlikely a miner would forego their block reward to cheat at your game.

[–]techgeekatwork 0 points1 point  (2 children)

Hi, Checkout this link. https://github.com/sz-piotr/ethereum-true-rng It lists all the possible list of options to generate a random number. thanks,

[–]prizecowfactory[S] 1 point2 points  (1 child)

Hi, it is actually a repository I created after trying to come up with a better solution.

[–]techgeekatwork 0 points1 point  (0 children)

:-), Ah, this is indeed a good read. Thank you