Skip to content

Instantly share code, notes, and snippets.

@smitroshin
Created December 1, 2021 14:29
Show Gist options
  • Save smitroshin/4bd01cdc04f446a5bd8ed95f93b40c9d to your computer and use it in GitHub Desktop.
Save smitroshin/4bd01cdc04f446a5bd8ed95f93b40c9d to your computer and use it in GitHub Desktop.
Generate Random Whole Numbers within a Range
/**
* Generate Random Whole Numbers within a Range
*
* Source: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range
*
* @param {number} min
* @param {number} max
*/
const randomRange(min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment