Skip to content

Commit

Permalink
Merge pull request Expensify#26171 from JKobrynski/migrateStyleUtilsT…
Browse files Browse the repository at this point in the history
…oTypeScript

[No QA] [TS Migration] Migrate StyleUtils.js to TypeScript
  • Loading branch information
neil-marcellini authored Sep 4, 2023
2 parents 5691303 + 59c7bf4 commit d971190
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 381 deletions.
16 changes: 15 additions & 1 deletion src/libs/NumberUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,18 @@ function generateHexadecimalValue(num) {
.toUpperCase();
}

export {rand64, generateHexadecimalValue};
/**
* Generates a random integer between a and b
* It's and equivalent of _.random(a, b)
*
* @param {Number} a
* @param {Number} b
* @returns {Number} random integer between a and b
*/
function generateRandomInt(a, b) {
const lower = Math.ceil(Math.min(a, b));
const upper = Math.floor(Math.max(a, b));
return Math.floor(lower + Math.random() * (upper - lower + 1));
}

export {rand64, generateHexadecimalValue, generateRandomInt};
Loading

0 comments on commit d971190

Please sign in to comment.