mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Refactor based on NextJS 13 Routing / Dir Layout
This commit is contained in:
19
www/app/lib/random.js
Normal file
19
www/app/lib/random.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export function getRandomNumber(min, max) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
export function SeededRand(seed) {
|
||||
seed ^= seed << 13;
|
||||
seed ^= seed >> 17;
|
||||
seed ^= seed << 5;
|
||||
return seed / 2 ** 32;
|
||||
}
|
||||
|
||||
export function Mulberry32(seed) {
|
||||
return function () {
|
||||
var t = (seed += 0x6d2b79f5);
|
||||
t = Math.imul(t ^ (t >>> 15), t | 1);
|
||||
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
||||
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
||||
};
|
||||
}
|
||||
11
www/app/lib/time.js
Normal file
11
www/app/lib/time.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export const formatTime = (seconds) => {
|
||||
let hours = Math.floor(seconds / 3600);
|
||||
let minutes = Math.floor((seconds % 3600) / 60);
|
||||
let secs = Math.floor(seconds % 60);
|
||||
|
||||
let timeString = `${hours > 0 ? hours + ":" : ""}${minutes
|
||||
.toString()
|
||||
.padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
||||
|
||||
return timeString;
|
||||
};
|
||||
Reference in New Issue
Block a user