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

What is number in javascript?

812


What is the difference between script type and the script language attributes?

907


Where javascript variables are stored?

985


What's relationship between JavaScript and ECMAScript? And What are JavaScript types?

1005


How many types of functions are there in javascript?

856


Explain javascript debounce function?

979


What does "1"+2+3 evaluate to?

886


What is null in js?

896


How to capture the Image width and height using QTP script ? Kindly answer plz.... Thanx in adavance...

3971


How will you explain closures in javascript? When are they used?

932


Explain how to read and write a file using javascript?

911


Are javascript variables case sensitive?

849


Can I declare a variable as CONSTANT in JavaScript?

929


How can I learn javascript fast?

903


What is event bubbling in JavaScript?

961