# Partial Sorting

A **Partial Sorting** is a special technique that can be used to randomly sort only a part of teams in a competition.

# ImplementationEdit

Here's a possible implementation with UCP Scripting Syntax

#name "Partial Sorting example" // This example shows how to apply partial random sorting // to a pool with national teamscompWorldCup{ // A pool with 20 teams - 10 teams from South America and 10 teams from Oceania. // We want to make random pairs, but we want South American teams to play with // Oceanian teams. So we can't use shuffleTeams() at the end of the script - it // will randomly sort all teams. We put the shuffleTeams() command in the middle, // and that's what we call a "partial sorting"round"Test round" @testteams20matchdays3 {getNationalTeam(SouthAmerica)shuffleTeams() // will shuffle teams which are already added at this pointgetNationalTeam(Oceania) } }