title: Generate 5 random digit number using Javascript in Adobe Acrobat
body: <p>I'm using <code>if (this.getField("Form No").valueAsString=="") {<br>
      this.getField("Form No").value = util.printf("%05d", Math.floor((Math.random() * 99999) + 1000));<br>
  }</code></p>
  
  <p>In an attempt to fill a text field with a random 5 digit number in a PDF upon open. It seems to generate a number ranging from 5-6 digits instead of exactly 5. </p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks for the reples. I'm sorry but I'm very inexperienced when it comes to javascript. I assume you mean: </p>
  
  <p><code>function getRandomArbitrary(min, max) { return Math.random() * (max - min) + min; }</code></p>
  
  <p>But how would I actually put this in my own code with the 10000 as min and 99999 as max? </p>