Add dotnet-ish Random class

This commit is contained in:
Rory&
2025-10-03 20:29:32 +02:00
parent b681ae7522
commit 7d2fd7b4f8
4 changed files with 79 additions and 4 deletions

View File

@@ -18,7 +18,7 @@
import { Request } from "express";
import { ntob } from "./Base64";
import { FieldErrors } from "@spacebar/util";
import { FieldErrors, Random } from "@spacebar/util";
export function checkLength(
str: string,
@@ -40,5 +40,5 @@ export function checkLength(
}
export function generateCode() {
return ntob(Date.now() + Math.randomIntBetween(0, 10000));
return ntob(Date.now() + Random.nextInt(0, 10000));
}