Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can you write a random integers function to print integers with in a range?

Answer Posted / hrpatelsoft@gmail.com

function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
randomInteger(1, 100); // returns a random integer from 1 to 100
randomInteger(1, 1000); // returns a random integer from 1 to 1000

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is java better than javascript?

925


How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?

983


How to add multiple functions in javascript?

901


What is arguments object in JavaScript?

1124


Is javascript enabled on chrome?

911


How do you target a specific frame from a hyperlink in javascript?

941


How can a value be appended to an array?

953


Which built-in method returns the length of the string?

976


What is the use of isNaN function?

950


How to write a script for "select" lists using javascript

1094


Explain promise in javascript?

864


What is stack queue?

919


Where do I write javascript code?

1024


What is an ECMAScript?

1113


How to find the selected radio button immediately using the 'this' variable?

947