It is possible to generate truly (not pseudo) random number with specific range inside smart contacts

(for example I need random number between 1 and 60 000 )



1 Answer 1


There is no way to do so. Suppose there exists a way to generate a truly random number in a contract, then two nodes/ miners will generate two different values, thus end up having two different blockchain states. No consensus can be achieved in such scenario.

  • There are some ways #1, #2, #3
    – niksmac
    Commented Mar 28, 2016 at 12:53
  • @NikhilM op was asking about generating totally random numbers. Any solutions in your references can be easily biased.
    – Loi.Luu
    Commented Mar 28, 2016 at 14:56
  • 1
    I understand that, i just wanted to show you some possible ways since the question was already discussed in SE.
    – niksmac
    Commented Mar 28, 2016 at 15:44

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