2022-06-23 05:44:57 +00:00
|
|
|
import crypto from "crypto";
|
2022-06-22 01:51:09 +00:00
|
|
|
export function randomNumber(min, max) {
|
|
|
|
return Math.floor(Math.random() * (max - min) + min);
|
|
|
|
}
|
|
|
|
export function clamp(number, min, max) {
|
|
|
|
return Math.max(min, Math.min(number, max));
|
|
|
|
}
|
2022-06-23 05:44:57 +00:00
|
|
|
|
|
|
|
export function createCode() {
|
|
|
|
const randomString = crypto.randomBytes(3).toString("hex").toUpperCase()
|
|
|
|
return randomString
|
|
|
|
}
|