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

        $state = $this->getState();

        $min = (is_float($min)) ? $min : $state[Utils::sanitizeVariableRef($min)]->getValue();
        $max = (is_float($max)) ? $max : $state[Utils::sanitizeVariableRef($max)]->getValue();

        if (is_float($min) && is_float($max)) {

            if ($min <= $max) {
                return new QtiFloat(($min + lcg_value() * (abs($max - $min))));
            } else {
                $msg = "'min':'${min}' is greater than 'max':'${max}'.";
                throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::LOGIC_ERROR);
            }
        } else {
            $msg = "At least one of the following values is not a float: 'min', 'max'.";
            throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::WRONG_VARIABLE_BASETYPE);
        }
    }
public function process()
    {
        $expr = $this->getExpression();
        $min = $expr->getMin();
        $max = $expr->getMax();

        $state = $this->getState();

        $min = (is_float($min)) ? $min : $state[Utils::sanitizeVariableRef($min)]->getValue();
        $max = (is_float($max)) ? $max : $state[Utils::sanitizeVariableRef($max)]->getValue();

        if (is_float($min) && is_float($max)) {

            if ($min <= $max) {
                return new QtiFloat(($min + lcg_value() * (abs($max - $min))));
            } else {
                $msg = "'min':'${min}' is greater than 'max':'${max}'.";
                throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::LOGIC_ERROR);
            }
        } else {
            $msg = "At least one of the following values is not a float: 'min', 'max'.";
            throw new ExpressionProcessingException($msg, $this, ExpressionProcessingException::WRONG_VARIABLE_BASETYPE);
        }
    }
public function process ( ) { $ expr = $ this -> getExpression ( ) ; $ min = $ expr -> getMin ( ) ; $ max = $ expr -> getMax ( ) ; $ state = $ this -> getState ( ) ; $ min = ( is_float ( $ min ) ) ? $ min : $ state [ Utils :: sanitizeVariableRef ( $ min ) ] -> getValue ( ) ; $ max = ( is_float ( $ max ) ) ? $ max : $ state [ Utils :: sanitizeVariableRef ( $ max ) ] -> getValue ( ) ; if ( is_float ( $ min ) && is_float ( $ max ) ) { if ( $ min <= $ max ) { return new QtiFloat ( ( $ min + lcg_value ( ) * ( abs ( $ max - $ min ) ) ) ) ; } else { $ msg = "'min':'${min}' is greater than 'max':'${max}'." ; throw new ExpressionProcessingException ( $ msg , $ this , ExpressionProcessingException :: LOGIC_ERROR ) ; } } else { $ msg = "At least one of the following values is not a float: 'min', 'max'." ; throw new ExpressionProcessingException ( $ msg , $ this , ExpressionProcessingException :: WRONG_VARIABLE_BASETYPE ) ; } }
Process the RandomFloat expression.

* Throws an ExpressionProcessingException if 'min' is greater than 'max'.

@return float A Random float value.
@throws \qtism\runtime\expressions\ExpressionProcessingException
Process the RandomFloat expression .