0

I am using sha3 to create 3 unique id in a same function. But results are same for all of them because it is using timestamp like this "uint256 random = uint256(sha3(block.timestamp)) +1;".

So, I want to know how to create random or unique id which will be not dependent on timestamp?

0

1 Answer 1

1

Randomness can't be done in Solidity. If you aren't worried about someone gaming this, then you can sha256 the timestamp, then hash that hash to get another hash, then hash that hash to get another, and so on.

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