random numbers

This commit is contained in:
2025-11-21 23:37:12 +00:00
parent 0c02b481f6
commit a85f0d358f

View File

@@ -271,12 +271,17 @@ export function cyclicMa(rules, initialState, t) {
return states; return states;
} }
export function renderToCanvas(canvas, width, height, sn = 0, dn = 180) { export function renderToCanvas(canvas, width, height, sn = 0, dn = 0) {
if (sn == 0) { if (sn == 0) {
const min = 1500000; const min = 1500000;
const max = 2000000; const max = 2000000;
sn = Math.floor(Math.random() * (max - min + 1)) + min; sn = Math.floor(Math.random() * (max - min + 1)) + min;
} }
if (dn == 0) {
const min = 100;
const max = 200;
dn = Math.floor(Math.random() * (max - min + 1)) + min;
}
const r = 1; const r = 1;
const n = 2 * r + 1; const n = 2 * r + 1;
const rules = toMaRule(sn, dn, n, 2); const rules = toMaRule(sn, dn, n, 2);