12 lines
359 B
JavaScript
12 lines
359 B
JavaScript
|
import crypto from "crypto";
|
||
|
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));
|
||
|
}
|
||
|
export function createCode() {
|
||
|
const randomString = crypto.randomBytes(3).toString("hex").toUpperCase();
|
||
|
return randomString;
|
||
|
}
|