This commit is contained in:
Andras Schmelczer 2023-04-15 21:57:33 +01:00
parent 9cf8f73e18
commit 5cc94805f1
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
17 changed files with 670 additions and 237 deletions

8
src/utils/mulberry32.ts Normal file
View file

@ -0,0 +1,8 @@
export const mulberry32 = (seed) => () => {
let 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;
};
Math.random = mulberry32(123);

View file

@ -0,0 +1,3 @@
export const randomBetween = (min: number, max: number) => {
return Math.random() * (max - min) + min;
};