File size: 586 Bytes
7c447a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { useMemo } from 'react';
export function useIterationData(seed = 42, points = 50) {
function mulberry32(a:number){return function(){let t=(a+=0x6D2B79F5);t=Math.imul(t^(t>>>15),t|1);t^=t+Math.imul(t^(t>>>7),t|61);return ((t^(t>>>14))>>>0)/4294967296;};}
return useMemo(() => {
const rand = mulberry32(seed);
return Array.from({ length: points }, (_, i) => ({
iteration: i+1,
meanDifference: Math.max(0.1, 0.8 - i*0.012 + rand()*0.1),
groupA: 0.7 - i*0.006 + rand()*0.05,
groupB: 0.3 + i*0.003 + rand()*0.05,
}));
}, [seed, points]);
}
|