-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This needs some performance improvements
- Loading branch information
Showing
3 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Gets a random integer between 0 and max (inclusive). | ||
*/ | ||
export function getRandomInt(max: number) { | ||
return Math.floor(Math.random() * Math.floor(max)); | ||
} | ||
|
||
/** | ||
* Gets a random number between 0 and max (inclusive). | ||
*/ | ||
export function getRandomNumber(max: number) { | ||
return Math.random() * max; | ||
} | ||
|
||
/** | ||
* Gets a random OKLCH color that is bright and visible. | ||
*/ | ||
export function getRandomColor() { | ||
return `oklch(70% 0.5 ${getRandomNumber(360)})`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters