Some applications might need a random number generator (RNG) to perform specific tasks. There are many use cases where randomness is an essential part. For example, a decentralized lottery requires a random number to select the winner. Randomness can also be used to provide suggestions to the users of the application.
Generating a random number can be tricky in a decentralized system such as Ethereum for various reasons. Such functionality has to be achieved through design workarounds. In this chapter, you will learn how to build an RNG that can be used in your DApp.