feat: initial commit

This commit is contained in:
2024-03-12 18:41:52 +02:00
commit 2a359099ba
19 changed files with 1592 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
Copyright 2024 Resultium LLC
This file is part of @resultium/utils.
@resultium/utils is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
@resultium/utils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RCZ. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns a pseudo-random number in given range
*
* @remarks
* Uses Math.random(), which is not cryptographically secure
* Returns only integers
*
* @param min - minimum acceptable value
* @param max - maximum acceptable value
* @returns number [min; max]
*/
export const randomInRange = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min)) + min;
};