chore: Move API source code to API folder.

This commit is contained in:
greysoh 2024-04-28 14:21:47 -04:00
parent 8015b0af74
commit d3a664fea4
No known key found for this signature in database
GPG key ID: FE0F173B8FC01571
59 changed files with 43 additions and 38 deletions

View file

@ -1,26 +0,0 @@
function getRandomInt(min: number, max: number): number {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled); // The maximum is exclusive and the minimum is inclusive
}
export function generateRandomData(length: number): string {
let newString = "";
for (let i = 0; i < length; i += 2) {
const randomNumber = getRandomInt(0, 255);
if (randomNumber == 0) {
i -= 2;
continue;
}
newString += randomNumber.toString(16);
}
return newString;
}
export function generateToken() {
return generateRandomData(128);
}