1

This question already has an answer here:

How can i generate random number in contract?
Like this:

uint8(uint256(keccak256(block.timestamp, block.difficulty))%251);

but we cannot trust miner, this is not 100% random
Or use Oraclize:

oraclize_query("WolframAlpha", "random number between 0 and 100");

If it's correct? Will i get a effective random number? And how much gas usage?

marked as duplicate by Lauri Peltonen, Ismael, Community Jan 22 at 20:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.