Random number generators

in #ethereum8 years ago (edited)

Generally, when a computer is tasked to do something random, a pseudorandom number generator (PRNG) usually provides the randomness. To use a PRNG, a seed is given to shuffle the deck even more. Every seed generates a different sequence of random numbers. Because of this, however, the outcome of the random numbers generated can be predicted. Usually, for insecure, non-critical random number needs, a developer will choose to use the computer's clock as a seed. This makes for a fairly unpredictable sequence of numbers, since the sequence depends upon the exact millisecond reported by the computer at the time it checked the clock to generate the seed. If the sequence doesn't need to be re-created in the future, the seed is discarded. But, if the seed is saved, the sequence can be regenerated.

While this is fine for shuffling the deck to play solitaire, it won't work to generate random numbers that determine the outcome of smart contracts on Ethereum. I made a feeble attempt to create a random number generator suitable for that, but I failed miserably. It was exploited within a few days, seemly by the first person who tried.

Sort:  

Very nice post! Please feel free to check out my content as well!

Coin Marketplace

STEEM 0.26
TRX 0.21
JST 0.037
BTC 94986.45
ETH 3594.38
USDT 1.00
SBD 3.77