Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-22 20:24:04 +03:00
parent aedcded750
commit d35575373f
41 changed files with 148 additions and 88 deletions

View File

@ -3,12 +3,14 @@ title: randomIntegerInRange
tags: math,random,beginner
---
Returns a random integer in the specified range.
Generates a random integer in the specified range.
- Use `Math.random()` to generate a random number and map it to the desired range, using `Math.floor()` to make it an integer.
- Use `Math.random()` to generate a random number and map it to the desired range.
- Use `Math.floor()` to make it an integer.
```js
const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
const randomIntegerInRange = (min, max) =>
Math.floor(Math.random() * (max - min + 1)) + min;
```
```js