javascript-code-challenges
javascript-code-challenges copied to clipboard
wrong problem 3 solution: random inclusive range
This leads to rangeStart and rangeEnd appearing with half the frequency of everything in between, Math.round is not the solution here, you should use Math.floor(rangeStart + rangeEnd + 1)
see below for how the distribution with round looks:
@towc Improved the logic to fix the uneven distribution https://jscodechallenges.vercel.app/challenges/primitives#3-create-a-function-that-returns-a-random-number-in-the-given-range-of-values-both-inclusive
Thanks