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 causes memory leaks?

957


What is unobtrusive javascript?

992


Are Typescript and Javascript the same?

1048


What's the Difference Between Class and Prototypal Inheritance?

1187


How to get value from a textbox?

1207


How do I view javascript files in chrome?

961


How to clone an object in javascript?

1067


How do I open javascript in chrome?

977


What is let keyword in typescript?

1042


Explain the for-in loop?

968


What is the difference between client side javascript and server side javascript.

1174


What are self invoking functions?

1020


What is spread operator?

933


Event bubbling and Event Capturing in JavScript?

1047


Is javascript the future?

1010