<commit_before>package main

import (
	"log"
	"math/rand"
	"time"
)

var santaList = make([]Pair, 0)

func main() {
	names := [10]string{"Ally", "Gus",
		"Roger", "Danil", "Isabel", "Pete",
		"Rob", "Renee", "Shannon", "Greg"}
	permutations := make([]Pair, 0)
	shuffledPermutations := make([]Pair, 0)
	for i := 0; i < len(names); i++ {
		for j := i + 1; j < len(names); j++ {
			forwardPair := Pair{santa: names[i], receiver: names[j]}
			permutations = append(permutations, forwardPair)
			backwardPair := Pair{santa: names[len(names)-(i+1)],
				receiver: names[len(names)-(j+1)]}
			permutations = append(permutations, backwardPair)
		}
	}
	rand.Seed(time.Now().UnixNano())
	for len(permutations) > 0 {
		random := rand.Intn(len(permutations))
		shuffledPermutations = append(shuffledPermutations, permutations[random])
		permutations = append(permutations[:random], permutations[random+1:]...)
	}
	for _, pair := range shuffledPermutations {
		if len(santaList) == 2*len(names) {
			break
		}
		if isValidPair(pair) {
			santaList = append(santaList, pair)
		}
	}
	for _, pair := range santaList {
		log.Printf("%s --> %s\n", pair.santa, pair.receiver)
	}
}

func isValidPair(pair Pair) bool {
	for _, santaPair := range santaList {<commit_msg>Add comments and clean up<commit_after>package main

import (
	"log"
	"math/rand"
	"time"
)

var santaList = make([]Pair, 0)

func main() {
	names := [10]string{"Ally", "Gus",
		"Roger", "Danil", "Isabel", "Pete",
		"Rob", "Renee", "Shannon", "Greg"}
	permutations := make([]Pair, 0)
	shuffledPermutations := make([]Pair, 0)

	// create all permutations
	for i := 0; i < len(names); i++ {
		for j := i + 1; j < len(names); j++ {
			forwardPair := Pair{santa: names[i], receiver: names[j]}
			backwardPair := Pair{santa: names[len(names)-(i+1)],
				receiver: names[len(names)-(j+1)]}
			permutations = append(permutations, forwardPair, backwardPair)
		}
	}

	// randomly shuffle list of permutations
	rand.Seed(time.Now().UnixNano())
	for len(permutations) > 0 {
		random := rand.Intn(len(permutations))
		shuffledPermutations = append(shuffledPermutations, permutations[random])
		permutations = append(permutations[:random], permutations[random+1:]...)
	}

	// iterate over permutations until full
	for _, pair := range shuffledPermutations {
		if len(santaList) == 2*len(names) {
			break
		}
		if isValidPair(pair) {
			santaList = append(santaList, pair)
		}
	}

	// print out results
	for _, pair := range santaList {
		log.Printf("%s --> %s\n", pair.santa, pair.receiver)
	}
}

// determine whether or not a giver or receiver in this pair has already been used
func isValidPair(pair Pair) bool {
	for _, santaPair := range santaList {
{'fraction_non_alphanumeric': 0.1706954258088509, 'fraction_numerical': 0.008925251022685012, 'mean_word_length': 4.326732673267327, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5249203', 'n_tokens_mistral': 1091, 'n_tokens_neox': 976, 'n_words': 231}