Random number in range [min - max] using PHP

Solution 1:

<?php
  $min=1;
  $max=20;
  echo rand($min,$max);
?>

Solution 2:

In a new PHP7 there is a finally a support for a cryptographically secure pseudo-random integers.

int random_int ( int $min , int $max )

random_int — Generates cryptographically secure pseudo-random integers

which basically makes previous answers obsolete.