title: How do I set a random number between two variables in batch?
body: <p>I am trying to get a random number between 25 and 50, but be able to change it by changing the variables, what is the code for this?</p>
  
  <p>ive tried all of these solutions:
  set /a var=(%random%*%maxvar%/32768)+%minvar
  set /a var=%random% %% %maxvar% + %minvar%
  and plenty of other solutions ive found.</p>
  
  <pre><code>set %maxvar%=50
  set %minvar%=25
  
  set /a var=%random% %% %maxvar% %minvar%
  </code></pre>
  
  <p>I would do the same in my code but want to replace the 50 and 25 with the variables.</p>
  
  <p>I thought the output would end up somewhere between the two variables but it just ends up with either negative numbers or numbers above 50.</p>