array ( 'id' => 1, 'nome' => 'ISABELA SILVA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 1 => array ( 'id' => 2, 'nome' => 'BENTO GOMES SILVEIRA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 2 => array ( 'id' => 5, 'nome' => 'MARIA CECÍLIA SUZANO MARIANO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 3 => array ( 'id' => 8, 'nome' => 'JOÃO BERNARDO CARDOSO DOS ANJOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 4 => array ( 'id' => 11, 'nome' => 'JOÃO MIGUEL LAURINDO RODRIGUES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 5 => array ( 'id' => 13, 'nome' => 'BRYAN LUCCA CARDOZO RODRIGUES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 6 => array ( 'id' => 16, 'nome' => 'PÉROLA BARBOSA ABREU', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 7 => array ( 'id' => 18, 'nome' => 'ISABELLY CARDOSO DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 8 => array ( 'id' => 21, 'nome' => 'MARIA ALICE DOS SANTOS RIBEIRO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 9 => array ( 'id' => 23, 'nome' => 'VICTOR EMANUEL TAVARES DA SILVA', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => true, 'has_siblings' => false, ), 10 => array ( 'id' => 25, 'nome' => 'AYLLA MARIA SANTOS OLIVEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 11 => array ( 'id' => 29, 'nome' => 'SARA VITÓRIA MOTA CAPISTRANO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 12 => array ( 'id' => 33, 'nome' => 'HELENA RIBEIRO CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 13 => array ( 'id' => 35, 'nome' => 'KATLEYA CARDOSO RIBEIRO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 14 => array ( 'id' => 38, 'nome' => 'THEO RODRIGUES VITAL', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 15 => array ( 'id' => 41, 'nome' => 'LUNNA DANTAS CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 16 => array ( 'id' => 43, 'nome' => 'SAMUEL CARDOSO DE SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 17 => array ( 'id' => 45, 'nome' => 'JOAQUIM NEVES CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 18 => array ( 'id' => 46, 'nome' => 'LUNNA THAYNA DE MACÊDO SILVA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 19 => array ( 'id' => 47, 'nome' => 'ISABELLE CARDOSO DE SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 20 => array ( 'id' => 48, 'nome' => 'SOFIA DE SOUZA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 21 => array ( 'id' => 52, 'nome' => 'MARIA ALICE RIBEIRO DAMACENO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 22 => array ( 'id' => 56, 'nome' => 'YASMIM DE MENEZES GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 23 => array ( 'id' => 60, 'nome' => 'ÍSIS TELES CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 24 => array ( 'id' => 64, 'nome' => 'MARIA VALENTINA DANTAS DA SILVA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 25 => array ( 'id' => 67, 'nome' => 'NOAH ASLAM DAS NEVES FERREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 26 => array ( 'id' => 71, 'nome' => 'ANALICE FERREIRA DE MENEZES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 27 => array ( 'id' => 74, 'nome' => 'THAYNÁ MORAES DE SANTANA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 28 => array ( 'id' => 76, 'nome' => 'MELINDA CORDEIRO DE SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 29 => array ( 'id' => 78, 'nome' => 'ISAAC DA SILVA RIBEIRO DOS SANTOS', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => false, 'has_siblings' => false, ), 30 => array ( 'id' => 80, 'nome' => 'LEVI CORDEIRO DE SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 31 => array ( 'id' => 82, 'nome' => 'ISIS DA SILVA RIBEIRO DOS SANTOS', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => false, 'has_siblings' => false, ), 32 => array ( 'id' => 85, 'nome' => 'MARIA ALICE CARDOSO BORGES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 33 => array ( 'id' => 87, 'nome' => 'PIETRO DA SILVA SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 34 => array ( 'id' => 93, 'nome' => 'YARA ANDRADE FERREIRA DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 35 => array ( 'id' => 94, 'nome' => 'MÉLANY LUISA BORGES DUARTE', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 36 => array ( 'id' => 106, 'nome' => 'BERNARDO ALVES FERREIRA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 37 => array ( 'id' => 109, 'nome' => 'LUIZA CARDOSO DIAS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 38 => array ( 'id' => 110, 'nome' => 'THÉO FILIPE BORGES PEREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 39 => array ( 'id' => 115, 'nome' => 'HEITOR MIGUEL CARDOSO DE MACÊDO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 40 => array ( 'id' => 119, 'nome' => 'ELIAS GONÇALVES DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 41 => array ( 'id' => 120, 'nome' => 'MATHEUS CARDOSO DA SILVA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 42 => array ( 'id' => 124, 'nome' => 'DAVI GAEL ELPIDIO DANTAS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 43 => array ( 'id' => 128, 'nome' => 'GAEL CARDOSO LIMA', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => false, 'has_siblings' => true, ), 44 => array ( 'id' => 133, 'nome' => 'ELIAS VIANA BORGES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 45 => array ( 'id' => 135, 'nome' => 'VALENTIM DA SILVA ALVES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 46 => array ( 'id' => 136, 'nome' => 'RAVI LUCAS BARBOSA DE OLIVEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 47 => array ( 'id' => 143, 'nome' => 'ADRYAN EMANUEL DOS SANTOS FERREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 48 => array ( 'id' => 144, 'nome' => 'NADIR BONFIM DE ABREU', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 49 => array ( 'id' => 145, 'nome' => 'ARTHUR BONFIM DE ABREU', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 50 => array ( 'id' => 146, 'nome' => 'MARIA ALICE SOUZA DANTAS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 51 => array ( 'id' => 148, 'nome' => 'MURILLO ARTHUR PEREIRA DA COSTA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 52 => array ( 'id' => 150, 'nome' => 'MAITÊ DANTAS REIS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 53 => array ( 'id' => 151, 'nome' => 'DAFNE RODRIGUES DIAS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 54 => array ( 'id' => 152, 'nome' => 'ANA LUÍSA RIBEIRO DAMASCENO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 55 => array ( 'id' => 156, 'nome' => 'ISABELLY RIBEIRO DE ALMEIDA SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 56 => array ( 'id' => 159, 'nome' => 'HEITOR SILVA CARDOSO TANAN', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 57 => array ( 'id' => 161, 'nome' => 'RAVY DA SILVA CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 58 => array ( 'id' => 163, 'nome' => 'JOAQUIM VINÍCIUS PEREIRA SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 59 => array ( 'id' => 164, 'nome' => 'RAVI LUCCA DA SILVA FRANÇA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 60 => array ( 'id' => 166, 'nome' => 'ALLANA GOMES DA SILVA BRITO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 61 => array ( 'id' => 169, 'nome' => 'MARIA LUIZA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 62 => array ( 'id' => 172, 'nome' => 'MIGUEL GOMES VARJÃO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 63 => array ( 'id' => 174, 'nome' => 'JOSÉ EMANUEL LOIOLA DE SOUZA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 64 => array ( 'id' => 179, 'nome' => 'ANA JÚLIA LOIOLA CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 65 => array ( 'id' => 180, 'nome' => 'JOÃO RAFAEL RODRIGUES SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 66 => array ( 'id' => 183, 'nome' => 'SAMUEL LEVI CARDOSO DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 67 => array ( 'id' => 184, 'nome' => 'ISABELLA LOPES CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 68 => array ( 'id' => 186, 'nome' => 'GUILHERME ZEFERINO CHAVES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 69 => array ( 'id' => 187, 'nome' => 'EVELYN ZEFERINO CHAVES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 70 => array ( 'id' => 192, 'nome' => 'GUSTAVO HENRIQUE RODRIGUES CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 71 => array ( 'id' => 195, 'nome' => 'LEVI CARDOSO BISPO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 72 => array ( 'id' => 197, 'nome' => 'MARIA FLOR RODRIGUES SANTOS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 73 => array ( 'id' => 199, 'nome' => 'BENICIO MIGUEL VIEIRA PEREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 74 => array ( 'id' => 203, 'nome' => 'BENJAMIM FERNANDES GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => true, 'is_nearby' => true, 'has_siblings' => false, ), 75 => array ( 'id' => 204, 'nome' => 'DIOGO FERREIRA DE ALMEIDA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 76 => array ( 'id' => 205, 'nome' => 'JOSÉ FELLIPE ABREU DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 77 => array ( 'id' => 207, 'nome' => 'ELIZA CORDEIRO DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 78 => array ( 'id' => 208, 'nome' => 'LAYZA CORDEIRO DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 79 => array ( 'id' => 210, 'nome' => 'RAEL FELIPE FERREIRA MARIANO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 80 => array ( 'id' => 214, 'nome' => 'DAVI LUCCA VIEIRA GONÇALVES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 81 => array ( 'id' => 232, 'nome' => 'LORENA TORQUATO LOIOLA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 82 => array ( 'id' => 235, 'nome' => 'LIZ MELL DE SOUZA MORAIS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 83 => array ( 'id' => 236, 'nome' => 'MAITÊ MENEZES DE SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 84 => array ( 'id' => 239, 'nome' => 'ANTHONY DAVI RIBEIRO PRUDENCIO', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => false, 'has_siblings' => false, ), 85 => array ( 'id' => 248, 'nome' => 'ANTHONY CARDOSO DOS SANTOS FELIX', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 86 => array ( 'id' => 256, 'nome' => 'ALAN GAEL COSTA DA CONCEICAO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 87 => array ( 'id' => 260, 'nome' => 'AURORA CATTARINA ALMEIDA FERREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 88 => array ( 'id' => 262, 'nome' => 'MARIA LUIZA MENEZES RIBEIRO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 89 => array ( 'id' => 263, 'nome' => 'IASMIN MOURA DE MORAIS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 90 => array ( 'id' => 267, 'nome' => 'ZAYA SILVANO CARDOSO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 91 => array ( 'id' => 268, 'nome' => 'JOSÉ ARTHUR SANTOS VARJÃO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 92 => array ( 'id' => 270, 'nome' => 'DEYVID OLIVEIRA DA CRUZ', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 93 => array ( 'id' => 273, 'nome' => 'ESTER CARDOSO DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 94 => array ( 'id' => 292, 'nome' => 'MARIA ALICE RODRIGUES ROMÃO', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 95 => array ( 'id' => 294, 'nome' => 'ANA KETLYN DE ALMEIDA OLIVEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 96 => array ( 'id' => 299, 'nome' => 'NICOLAS CORDEIRO DANTAS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 97 => array ( 'id' => 301, 'nome' => 'CECÍLIA DE SOUZA MOREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 98 => array ( 'id' => 311, 'nome' => 'NATHAN BARBOSA SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 99 => array ( 'id' => 317, 'nome' => 'VICTOR LUAN DE SOUZA ALMEIDA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 100 => array ( 'id' => 319, 'nome' => 'MARIA ALICE DIAS CRUZ', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), ); function fisherYatesShuffle(array $items, $groupSeed) { $n = count($items); if ($n <= 1) return $items; $hashedSeed = hash('sha256', $groupSeed); for ($i = $n - 1; $i > 0; $i--) { $hash = hash_hmac('sha256', $i . $hashedSeed, $hashedSeed); $j = hexdec(substr($hash, 0, 8)) % ($i + 1); $temp = $items[$i]; $items[$i] = $items[$j]; $items[$j] = $temp; } return $items; } // SEPARAÇÃO DOS GRUPOS (IGUAL AO NOVO LOTTERYSERVICE) $g1 = []; $g2 = []; $g3 = []; $g4 = []; $g5 = []; foreach ($candidatos as $c) { // ALTERADO: PCD passa a ser a primeira verificação (Prioridade 1) if ($c['is_pcd']) { $g1[] = $c; } // ALTERADO: Social passa a ser a segunda verificação (Prioridade 2) elseif ($c['is_social_benefit']) { $g2[] = $c; } elseif ($c['is_nearby']) { $g3[] = $c; } elseif ($c['has_siblings']) { $g4[] = $c; } else { $g5[] = $c; } } echo "--- PROCESSANDO SORTEIO POR PRIORIDADES (NOVA HIERARQUIA) ---\n"; echo "G1: PCD | G2: SOCIAL | G3: PROXIMIDADE | G4: IRMÃOS | G5: AMPLA\n\n"; $r1 = fisherYatesShuffle($g1, $sementeBase . '_g1'); $r2 = fisherYatesShuffle($g2, $sementeBase . '_g2'); $r3 = fisherYatesShuffle($g3, $sementeBase . '_g3'); $r4 = fisherYatesShuffle($g4, $sementeBase . '_g4'); $r5 = fisherYatesShuffle($g5, $sementeBase . '_g5'); $resultadoFinal = array_merge($r1, $r2, $r3, $r4, $r5); echo "LISTA FINAL AUDITADA:\n"; foreach ($resultadoFinal as $index => $c) { echo sprintf("%03dº | %-30s | ID: %d\n", $index + 1, $c['nome'], $c['id']); }