This commit is contained in:
parent
9cf8f73e18
commit
5cc94805f1
17 changed files with 670 additions and 237 deletions
8
src/utils/mulberry32.ts
Normal file
8
src/utils/mulberry32.ts
Normal 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);
|
||||
3
src/utils/random-between.ts
Normal file
3
src/utils/random-between.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export const randomBetween = (min: number, max: number) => {
|
||||
return Math.random() * (max - min) + min;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue