Skip to content

Commit

Permalink
fix: Bug with randomElementFromList
Browse files Browse the repository at this point in the history
  • Loading branch information
ElrohirGT committed Nov 9, 2023
1 parent 3c31d44 commit d95be9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const randomIntBetween = (min, max) =>
* @param {[Object]} list A list of elements
* @returns {Object} The selected object
*/
export const getRandomElement = (list) => list[randomIntBetween(0, list.length)]
export const getRandomElement = (list) =>
list[randomIntBetween(0, list.length - 1)]

/**
* Checks if the given number `n` is in between min and max.
Expand Down

0 comments on commit d95be9b

Please sign in to comment.