<?php

/*
 * @component UserPoints
 * @copyright Copyright (C) 2015-2022 Bernard Gilly - Adrien Roussel - Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

namespace BlackSheepResearch\Component\UserPoints\Site\Problems;

defined('_JEXEC') or die;

class Random {

    public static function get(int $from, int $to, array $excluded = []) {
        $func = function_exists('random_int') ? 'random_int' : 'mt_rand';
        do {
            $number = $func($from, $to);
        } while (in_array($number, $excluded, true));

        return $number;
    }
}
