Generating Random Numbers

  • Uploaded by: SRINIVASA RAO GANTA
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Generating Random Numbers as PDF for free.

More details

  • Words: 61
  • Pages: 1
Record 3: Generating Random Numbers

function randRange(minNum, maxNum, decPl) { trace("random number between"+minNum+" and "+maxNum+ "is"); if(decp1==undefined) decp1=0; else decp1=decp1; var rangeDiff = (maxNum - minNum) * Math.pow(10, decPl) + 1; var randVal = Math.random(

) * rangeDiff;

randVal = Math.floor(randVal); randVal /= Math.pow(10, decPl); randVal += minNum; return Math.floor(randVal, Math.pow(10, -decPl)); }

trace(randRange(100,250,0));

Output random number between100 and 250is 244

Related Documents

Random
December 2019 55
Generating Past
October 2019 19
Numbers
April 2020 65
Numbers
November 2019 66

More Documents from "api-3751550"