<?xml version="1.0" encoding="UTF-8"?>
<question type="fillblanks">
  <!--
  The values used in the question are calculated first.

  the first two expressions generate random numbers. store="1" means that
  those two expressions are only evaluated the first time a user views the
  question. The values are then stored and loaded the next time.

  The other expressions are evaluated every time the user views the question.

  Expressions specifying store="1" should always be the first expressions.

  The two variables min and max, and the given answer are exported so they can be loaded by different questions.
  -->
  <matheval expression="a=random()" store="1" />
  <matheval expression="b=random()" store="1" />
  <matheval expression="min=round(a*5+1,2)" />
  <matheval expression="max=round(b*5+6,0)" />

  <text>
    <p>This question demonstrates the passing of generated values and the user's answer to another question.</p>
    <p>Please give a number between <mathresult expression="min" /> and <mathresult expression="max" />: <inlineChoice identifier="c" freeform="1" /></p>

  </text>

  <mapping correct="0" stop="1">
    <not><match inlineChoice="c" pattern="^[+-]?[0-9]+(\.[0-9]+)?(e[+-]?[0-9]+)?$" /></not>
    <feedback>Please give a number.</feedback>
  </mapping>

  <mapping correct="0" stop="1">
    <not><range inlineChoice="c" minval="min" maxval="max" /></not>
    <feedback>Your given answer is not between <mathresult expression="min" /> and <mathresult expression="max" />.</feedback>
  </mapping>

  <mapping correct="1">
    <range inlineChoice="c" minval="min" maxval="max" />
    <feedback>Thank you. Your given number <mathresult expression="c" /> is between <mathresult expression="min" /> and <mathresult expression="max" />.</feedback>
    <mathexport varname="min" exportname="q4min" />
    <mathexport varname="max" exportname="q4max" />
    <mathexport varname="c" exportname="q4ans" />
  </mapping>

</question>