sivaramaiah  
 
  Record3 04/19/2024 2:49pm (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

 


-----------------------------
  Offline Messages
  Adds
  Visitors Information
Today, there have been 119583 visitors (281264 hits) on this page!
-------------------------------------------------- This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free