From 57894e4c88d61381c0776e92f87b4ea461005599 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Sat, 8 Sep 2018 13:20:36 +0000 Subject: [PATCH] Travis build: 409 --- docs/math.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/math.html b/docs/math.html index 711292550..1991adea0 100644 --- a/docs/math.html +++ b/docs/math.html @@ -232,7 +232,7 @@ own individual rating by supplying it as the third argument.
randomIntegerInRange(0, 5); // 2
Returns a random number in the specified range.
Use Math.random() to generate a random value, map it to the desired range using multiplication.
const randomNumberInRange = (min, max) => Math.random() * (max - min) + min;
randomNumberInRange(2, 10); // 6.0211363285087005 -
Rounds a number to a specified amount of digits.
Use Math.round() and template literals to round the number to the specified number of digits. Omit the second argument, decimals to round to an integer.
const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); +
Rounds a number to a specified amount of digits.
Use Math.round() and template literals to round the number to the specified number of digits. Omit the second argument, decimals to round to an integer.
const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`);
round(1.005, 2); // 1.01
Hashes the input string into a whole number.
Use String.split('') and Array.reduce() to create a hash of the input string, utilizing bit shifting.
const sdbm = str => { let arr = str.split('');