Travis build: 1231
This commit is contained in:
24
README.md
24
README.md
@ -229,6 +229,7 @@ average(1, 2, 3);
|
|||||||
* [`percentile`](#percentile)
|
* [`percentile`](#percentile)
|
||||||
* [`powerset`](#powerset)
|
* [`powerset`](#powerset)
|
||||||
* [`primes`](#primes)
|
* [`primes`](#primes)
|
||||||
|
* [`randomIntArrayInRange`](#randomintarrayinrange)
|
||||||
* [`randomIntegerInRange`](#randomintegerinrange)
|
* [`randomIntegerInRange`](#randomintegerinrange)
|
||||||
* [`randomNumberInRange`](#randomnumberinrange)
|
* [`randomNumberInRange`](#randomnumberinrange)
|
||||||
* [`round`](#round)
|
* [`round`](#round)
|
||||||
@ -3504,6 +3505,29 @@ primes(10); // [2,3,5,7]
|
|||||||
<br>[⬆ Back to top](#table-of-contents)
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
|
### randomIntArrayInRange
|
||||||
|
|
||||||
|
Returns an array of n random integers in the specified range.
|
||||||
|
|
||||||
|
Use `Array.from()` to create an empty array of the specific length, `Math.random()` to generate a random number and map it to the desired range, using `Math.floor()` to make it an integer.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const randomIntArrayInRange = (min, max, n = 1) =>
|
||||||
|
Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min);
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
randomIntArrayInRange(12, 35, 10); // [ 34, 14, 27, 17, 30, 27, 20, 26, 21, 14 ]
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
### randomIntegerInRange
|
### randomIntegerInRange
|
||||||
|
|
||||||
Returns a random integer in the specified range.
|
Returns a random integer in the specified range.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@ Use `Array.from()` to create an empty array of the specific length, `Math.random
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const randomIntArrayInRange = (min, max, n = 1) =>
|
const randomIntArrayInRange = (min, max, n = 1) =>
|
||||||
Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min);
|
Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min);
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -140,8 +140,8 @@ pull:array
|
|||||||
pullAtIndex:array
|
pullAtIndex:array
|
||||||
pullAtValue:array
|
pullAtValue:array
|
||||||
randomHexColorCode:utility,random
|
randomHexColorCode:utility,random
|
||||||
randomIntegerInRange:math,utility,random
|
|
||||||
randomIntArrayInRange:math,utility,random
|
randomIntArrayInRange:math,utility,random
|
||||||
|
randomIntegerInRange:math,utility,random
|
||||||
randomNumberInRange:math,utility,random
|
randomNumberInRange:math,utility,random
|
||||||
readFileLines:node,array,string
|
readFileLines:node,array,string
|
||||||
redirect:browser,url
|
redirect:browser,url
|
||||||
|
|||||||
Reference in New Issue
Block a user