4

In order to get a random number between 0 and 51, I use this following equation:

index.push((uint(sha256(block.coinbase, block.number, block.timestamp)))%52);

but why the result turns out that it is not that randomized otherwise the distribution is restricted in a narrow region?

3

What do you mean by randomized distribution? I guess you are referring to uniform distribution. Why do you claim that it is not uniform? How much is the size of your sample set? You need to test it with large enough number of samples to see the uniformity of the distribution. Something like 100, 000 samples may work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.