Update lib/extramath.js

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
Namhyeon Go 2025-08-20 17:25:51 +09:00 committed by GitHub
parent 83b022bf6f
commit 1dd02f7a75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,7 +73,7 @@ function cartesianProduct(arr) {
function clusteredCellsDensity(numbers, size, minDensity) {
if (!numbers || !numbers.length) return false;
if (typeof size !== 'number' || size <= 0) size = 4; // default grid size = 4
if (typeof minDensity === 'undefined') minDensity = 0.6;
if (typeof minDensity !== 'number' || isNaN(minDensity)) minDensity = 0.6;
var maxIndex = size * size; // because it's 1-based (1..size*size)