* Generate a random number between min and max * Value is inclusive of both min and max values. * * @param {number} min * @param {number} max * @return {number}
(min, max)
| 679 | * @return {number} |
| 680 | */ |
| 681 | function range(min, max) { |
| 682 | const values = Array.apply(null, new Array(max - min + 1)).map( |
| 683 | (_, i) => min + i |
| 684 | ); |
| 685 | return values[Math.round(Math.random() * (max - min))]; |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * Returns the result of a coin flip, true or false |
no test coverage detected