Smart contracts are incredibly objective and rely on consensus from decentralized networks. For a set of validators to reach consensus on a set of actions, the computations involved must be reproducible; the ability to consistently achieve the same output from the same inputs makes the system deterministic.
How could you produce a random number in such an environment? If a random number is created within a process, you won't be able to repeat that process and get the same random number. If you could, it wouldn't truly be random. The solution is to produce the random number off-chain
Off-chain solutions are not all equal. Any provider must be sufficiently transparent to be a trustworthy source. By adding a layer of encryption, a verifiable proof can be submitted to the blockchain before the random number is needed/used. Chainlink VRF acts as an oracle to provide this service to blockchains.
An oracle is a medium through which real-world data reaches a blockchain. Smart contracts can only operate within the confines of on-chain data; oracles act as APIs for blockchains to make up for that limitation.
VRF uses open source code and cryptography to create its source of randomness. When a random number is requested, the random value(s) and a proof for how they were created are established. The proof is first published on chain, pre-verifying that the number to come has been created in a fair and unbiased fashion; the number is then published on chain a few blocks later when it's actually needed.
The number cannot be rejected and re-generated for a more favorable outcome by validators, because it was already verified via its proof several blocks ago.
Chainlink references Goldberg's paper on verifiable random numbers here to further detail how elliptic curve cryptography and a cryptographic proof are sufficient to achieve this.
Tamper-proof unpredictability enables exciting interactions and unbiased outcomes
Randomness allows for:
Chainlink VRF is currently in version 2. This tool is multichain; while Chainlink itself is based on Ethereum, VRF as a tool is chain agnostic. This tool is used by metaverse games, NFTs, and even blockchain consensus itself.