Fibonacci and random
This commit is contained in:
7
snippets/random-number-in-range.md
Normal file
7
snippets/random-number-in-range.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Random number in range
|
||||
|
||||
Use `Math.random()` to generate a random value, map it to the desired range using multiplication.
|
||||
|
||||
```js
|
||||
var randomInRange = (min, max) => Math.random() * (max - min) + min;
|
||||
```
|
||||
Reference in New Issue
Block a user