array ( 'id' => 3, 'nome' => 'CAROL VALENTINA DOS SANTOS SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 1 => array ( 'id' => 4, 'nome' => 'KARINY LOIZA MARQUES GUIMARÃES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 2 => array ( 'id' => 9, 'nome' => 'VITÓRIA EMANUELY RIBEIRO RODRIGUES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 3 => array ( 'id' => 12, 'nome' => 'MARIA CLARA DUARTE DA SILVA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 4 => array ( 'id' => 15, 'nome' => 'MARIA ISABEL MATOS CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 5 => array ( 'id' => 17, 'nome' => 'CATHARINE MARIA MARQUES DE ANDRADE', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 6 => array ( 'id' => 19, 'nome' => 'ISABELLE DIAS SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 7 => array ( 'id' => 20, 'nome' => 'HEITOR DANTAS COSTA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 8 => array ( 'id' => 22, 'nome' => 'EMILY MARIA MOTA ARAÚJO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 9 => array ( 'id' => 24, 'nome' => 'ELOISA ALMEIDA CAMPOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 10 => array ( 'id' => 27, 'nome' => 'EDUARDA DA SILVA MACEDO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 11 => array ( 'id' => 28, 'nome' => 'ANA ROSA CARDOSO SOUZA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 12 => array ( 'id' => 30, 'nome' => 'ANNY GABRIELY DOS SANTOS LOIOLA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 13 => array ( 'id' => 32, 'nome' => 'ALICE SOARES FRANÇA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 14 => array ( 'id' => 36, 'nome' => 'JORGE LUIS DE JESUS BARBOSA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 15 => array ( 'id' => 37, 'nome' => 'LUNA GABRIELE LIMA ANDRADE', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 16 => array ( 'id' => 39, 'nome' => 'SARA RECEBA CARDOSO GUIMARÃES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 17 => array ( 'id' => 40, 'nome' => 'NEYMAR DE AMARANTE RODRIGUES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 18 => array ( 'id' => 42, 'nome' => 'MAYCK LYAN DANTAS ARAÚJO', 'is_social_benefit' => false, 'is_pcd' => true, 'is_nearby' => false, 'has_siblings' => false, ), 19 => array ( 'id' => 44, 'nome' => 'NEYMAR AMARANTE RODRIGUES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 20 => array ( 'id' => 49, 'nome' => 'ANA JÚLIA CARDOSO GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 21 => array ( 'id' => 50, 'nome' => 'JORDANO VLADIMIR BRITO REBELO FILHO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 22 => array ( 'id' => 51, 'nome' => 'ANA JÚLIA CARDOSO GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 23 => array ( 'id' => 55, 'nome' => 'ANA CLARA DA SILVA SANTOS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 24 => array ( 'id' => 57, 'nome' => 'LAURA HELOÍSA ROCHA VARJAO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 25 => array ( 'id' => 58, 'nome' => 'ISRAEL VARJÃO RIBEIRO', 'is_social_benefit' => true, 'is_pcd' => true, 'is_nearby' => true, 'has_siblings' => false, ), 26 => array ( 'id' => 59, 'nome' => 'MARIA CECÍLIA BORGES CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 27 => array ( 'id' => 61, 'nome' => 'ALICE DA SILVA GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => true, 'is_nearby' => true, 'has_siblings' => true, ), 28 => array ( 'id' => 66, 'nome' => 'RIQUELME RIBEIRO DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 29 => array ( 'id' => 68, 'nome' => 'MARIA CLARA DE CARVALHO MACIEL', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 30 => array ( 'id' => 69, 'nome' => 'CARLOS HENRIQUE ALMEIDA CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 31 => array ( 'id' => 79, 'nome' => 'ANNA LUIZA RODRIGUES DA SILVA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 32 => array ( 'id' => 81, 'nome' => 'ELZA HELOISA OLIVEIRA FERREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 33 => array ( 'id' => 88, 'nome' => 'LUIZ MIGUEL DA SILVA BARBOSA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 34 => array ( 'id' => 92, 'nome' => 'VALENTINA CARDOSO LEITE', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 35 => array ( 'id' => 95, 'nome' => 'MAISA FRANÇA GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 36 => array ( 'id' => 96, 'nome' => 'JÚLIA SILVA TELLES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 37 => array ( 'id' => 99, 'nome' => 'MAYCON ANDRÉ PEREIRA ALMEIDA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 38 => array ( 'id' => 101, 'nome' => 'HUGO PIETRO DE SOUZA ALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 39 => array ( 'id' => 108, 'nome' => 'KAUÃ VICTOR DA SILVA PEREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 40 => array ( 'id' => 111, 'nome' => 'HIGOR.JOSE.DA.SILVA.BARBOSA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 41 => array ( 'id' => 116, 'nome' => 'SABRINA ALMEIDA DE OLIVEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 42 => array ( 'id' => 118, 'nome' => 'RUAN NUNES DE OLIVEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 43 => array ( 'id' => 122, 'nome' => 'PEDRO JORGE LOIOLA DA SILVA MOURA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 44 => array ( 'id' => 127, 'nome' => 'IZABELY VIANA PALMA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 45 => array ( 'id' => 131, 'nome' => 'ANNY HELOÍSA DOS SANTOS RIBEIRO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 46 => array ( 'id' => 132, 'nome' => 'IASMIN DA SILVA PEREIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 47 => array ( 'id' => 137, 'nome' => 'PAULO FELYPE BARBOSA DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 48 => array ( 'id' => 138, 'nome' => 'ANNY VITÓRIA DANTAS REIS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 49 => array ( 'id' => 140, 'nome' => 'LUIZ FELIPE CARDOSO TELES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 50 => array ( 'id' => 141, 'nome' => 'BRENO GABRIEL DANTAS DE SENA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 51 => array ( 'id' => 157, 'nome' => 'ALAN JONATHAN SOARES RAMOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 52 => array ( 'id' => 158, 'nome' => 'DAVI LUÍS DA COSTA VIEIRA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 53 => array ( 'id' => 168, 'nome' => 'RAFAEL CARDOSO DOS SANTOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 54 => array ( 'id' => 170, 'nome' => 'ARTHUR SANTANA REIS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 55 => array ( 'id' => 181, 'nome' => 'ISABELLA VITÓRIA LUIZ SANTOS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 56 => array ( 'id' => 189, 'nome' => 'RAQUEL VIEIRA GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => true, ), 57 => array ( 'id' => 201, 'nome' => 'JOAO VICTOR DILIO CARDOSO SANTANA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 58 => array ( 'id' => 212, 'nome' => 'ANA FLÁVIA LOIOLA CARDOSO GOMES', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 59 => array ( 'id' => 215, 'nome' => 'EMANUELY RIBEIRO DOS SANTOS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 60 => array ( 'id' => 222, 'nome' => 'UALACE CEZAR SOARES GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => true, 'is_nearby' => true, 'has_siblings' => false, ), 61 => array ( 'id' => 228, 'nome' => 'LAILA HELOYSE BARBOSA DA CONCEIÇÃO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 62 => array ( 'id' => 240, 'nome' => 'NATÁLY VITÓRIA CARDOSO DIAS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 63 => array ( 'id' => 250, 'nome' => 'LUÍS FERNANDO RODRIGUES DIAS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 64 => array ( 'id' => 271, 'nome' => 'DAVI LUIS DE SOUZA GONÇALVES', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 65 => array ( 'id' => 275, 'nome' => 'NATALY DOS SANTOS CARDOSO', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 66 => array ( 'id' => 281, 'nome' => 'EMILY LORRANE RODRIGUES CAMPOS', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => true, ), 67 => array ( 'id' => 284, 'nome' => 'RAVI DE ANDRADE MASCARENHAS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 68 => array ( 'id' => 291, 'nome' => 'DAVI DANTAS MAIA', 'is_social_benefit' => true, 'is_pcd' => false, 'is_nearby' => false, 'has_siblings' => false, ), 69 => array ( 'id' => 307, 'nome' => 'JHONATAS MATHEUS GONÇALVES BARBOSA', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), 70 => array ( 'id' => 323, 'nome' => 'ANTONIO PAULO DE JESUS SANTOS', 'is_social_benefit' => false, 'is_pcd' => false, 'is_nearby' => true, 'has_siblings' => false, ), ); 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']); }