mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-01-20 01:13:47 +05:00
refactor(helpers): refactor randomNum func
This commit is contained in:
parent
cf832a0e4a
commit
79bb43b851
1 changed files with 1 additions and 4 deletions
|
@ -62,10 +62,7 @@ export function shuffle(pArray) {
|
||||||
* @returns {number} A random integer between min and max.
|
* @returns {number} A random integer between min and max.
|
||||||
*/
|
*/
|
||||||
export function randomNum(min = 0, max = 100) {
|
export function randomNum(min = 0, max = 100) {
|
||||||
min = Math.floor(min);
|
return (Math.random() * (max - min + 1)) << 0;
|
||||||
max = Math.floor(max);
|
|
||||||
|
|
||||||
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue