11 Replies Latest reply on Nov 12, 2006 2:17 PM by twistedpancreas

    Math.random dropping off a decimal place

    twistedpancreas
      hello fellow peoples,

      got this problem

      this.input1.text = Math.round( (0.140 + Math.random() * 0.040) * 1000 ) / 1000;

      sometimes this gives an answer of 0.14 or 0.15, etc, etc...

      is there anyway to make it not drop off the end 0, ie it should be 0.140, or 0.150 (got a very specific chemistry client)

      thanks in advance