# Introduction to Chainlink VRF

Before diving into Chainlink VRF, it is important to understand why achieving randomness on-chain is very difficult and where VRF plays a part in achieving this.

#### Why is it hard to get randomness with smart contracts?

Blockchains are deterministic meaning that the output of any given input is always the same. This means that generating randomness on-chain is very difficult.&#x20;

As the output from on-chain randomness is predictable, smart contracts utilising this method of randomness are prone to manipulation. This allows validator nodes or participants to 'game' outcomes by controlling or initiating transactions in their favour, undermining the integrity and fairness of decentralised applications.

#### Chainlink VRF&#x20;

**Chainlink VRF (Verifiable Random Function)** is a provably fair and verifiable random number generator (RNG) that enables smart contracts to access random values without compromising security or usability.

{% embed url="<https://docs.chain.link/vrf>" %}
Chainlink VRF Documentation
{% endembed %}

{% hint style="info" %}

### <mark style="color:red;">Migration Warning</mark>

The next exercise uses Chainlink VRF 2.0, however Chainlink VRF 2.5 has since been released which has introduced some minor changes that need to implemented. Please refer the following migration guide for more details on these changes:
{% endhint %}

{% embed url="<https://docs.chain.link/vrf/v2-5/migration-from-v2>" %}
VRF 2.0 -> 2.5 Migration Guide
{% endembed %}
