public function process()
    {
        $expr = $this->getExpression();
        $min = $expr->getMin();
        $max = $expr->getMax();
        $step = $expr->getStep();
        $state = $this->getState();

        $min = (gettype($min) === 'integer') ? $min : $state[Utils::sanitizeVariableRef($min)]->getValue();
        $max = (gettype($max) === 'integer') ? $max : $state[Utils::sanitizeVariableRef($max)]->getValue();
        $step = (gettype($step) === 'integer') ? $step : $state[Utils::sanitizeVariableRef($step)]->getValue();

        if (gettype($min) === 'integer' && gettype($max) === 'integer' && gettype($step) === 'integer') {
            if ($min > $max) {
                $msg = "'min':'${min}' is greater than 'max':'${max}'.";
                throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::LOGIC_ERROR);
            }

            if ($step === 1) {
                return new QtiInteger(mt_rand($min, $max));
            } else {
                $distance = ($min < 0) ? ($max + abs($min)) : ($max - $min);
                $mult = mt_rand(0, intval(floor($distance / $step)));
                $random = new QtiInteger($min + ($mult * $step));

                return $random;
            }
        } else {
            $msg = "At least one of the following variables is not an integer: 'min', 'max', 'step' while processing RandomInteger.";
            throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::WRONG_VARIABLE_BASETYPE);
        }
    }