public function generatePassphrase($num_words = 4)
    {
        if (count($this->dictionary) < $num_words)
        {
            throw new UnderflowException(
                "Not enough words loaded to generate a passphrase of $num_words words"
            );
        }

        $words = array();
        $attempt = 0;
        while (count($words) < $num_words)
        {
            ++$attempt;
            $s = random_int(0, count($this->dictionary) - 1);
            $word = $this->dictionary[$s];
            if (!in_array($word, $words) || $attempt > 4 * $num_words)
                $words[] = $word;
        }
        return implode(" ", $words);
    }