title: How to ensure selected option value match the generated value from an equation with random variables
body: <p><a href="https://i.stack.imgur.com/8TP4f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8TP4f.png" alt="ed "></a></p>
  
  <p>Is there a way I ensure that the selected value matches the generated value of an equation with random variable as seen at the bottom of the graph.
  Object that stores data</p>
  
  <pre><code>        var STIIndexYearly = [
              {
                  year: 1988,
                  price: 1133.30
              },
            ...
              {
                  year: 2019,
                  price: 3153.73
              },
          ]
  </code></pre>
  
  <p>This is the code that generates the value</p>
  
  <pre><code>        var max = 31
          var min = 0
          var randomone = Math.floor(Math.random() * (max - min)) + min;
          var randomtwo = Math.floor(Math.random() * (max - randomone + 1)) + randomone + 1;
  
          var equationpart1 = ((STIIndexYearly[randomtwo].price / STIIndexYearly[randomone].price));
          var equationpart2 = (("1" / (STIIndexYearly[randomtwo].year - STIIndexYearly[randomone].year)));
  
          var answer = (Math.pow(equationpart1, equationpart2) - 1)```
  </code></pre>