sivaramaiah  
 
  Record3 10/18/2017 6:28pm (UTC)
   
 

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

 
  Menu Items
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

  add
HOT TOPICS
MCA PROJECT DETAILS ------------------------------------- Jntu all Lab manuals ------------------------------------- Jntu Syllabus Books ------------------------------------- Paper presentations ------------------------------------- Seminars ------------------------------------- Campus Papers ------------------------------------- Competetive Exams GATE ------------------------------------- GRE ------------------------------------- TOEFL ------------------------------------- IELTS ------------------------------------- CAT ------------------------------------- GMAT ------------------------------------- Templates ------------------------------------- Students Resume Preparation tips ------------------------------------- Job zone(Interview questions) ------------------------------------- Google Adsence html code ------------------------------------- Web sites --------x--------------x-----------
  Advertisement
  Advertisement

 


-----------------------------
  Offline Messages
  Adds
  Visitors Information
Today, there have been 66892 visitors (189295 hits) on this page!
=> Do you also want a homepage for free? Then click here! <= --------------------------------------------------