<commit_before>import java.util.ArrayList;
import java.util.Random;

public class BulkTest {

    private static final boolean PRINT_RESULTS = false;

    private static final int NUMBER_OF_TEAMS = 500;

    private static final int MIN_NUMBER_COACHES = 8;
    private static final int MAX_NUMBER_COACHES = 100;

    private static final int MIN_NUMBER_STUDENTS = 15;
    private static final int MAX_NUMBER_STUDENTS = 2500;

    private static final int MIN_NUMBER_COACHES_FOR_STUDENT = 1;
    private static final int MAX_NUMBER_COACHES_FOR_STUDENT = 8;


    private static int getRandom(int min, int max) {
        Random rand = new Random();
        return rand.nextInt((max - min) + 1) + min;
    }

    private static void addTeamToGraph(UserGraph graph, int teamNumber) {
        int numberOfCoaches = getRandom(MIN_NUMBER_COACHES, MAX_NUMBER_COACHES);
        User coaches[] = new User[numberOfCoaches];
        for (int i = 0; i < numberOfCoaches; i++) {
            coaches[i] = new User.Builder().build("Coach" + teamNumber + "_" + i);
            graph.addUser(coaches[i]);
        }

        int numberOfStudents = getRandom(MIN_NUMBER_STUDENTS, MAX_NUMBER_STUDENTS);
        for (int i = 0; i < numberOfStudents; i++) {
            User student = new User.Builder().build("Student" + teamNumber + "_" + i);
            int studentCoachCount =  getRandom(MIN_NUMBER_COACHES_FOR_STUDENT, MAX_NUMBER_COACHES_FOR_STUDENT);
            for (int j = 0; j < studentCoachCount; j++) {
                student.addCoach(coaches[getRandom(0, numberOfCoaches - 1)]);
            }
            graph.addUser(student);
        }
    }

    public static void main(String args[]) {
        UserGraph testGraph = new UserGraph.Builder().build();

        for (int i = 0; i < NUMBER_OF_TEAMS; i++) {
            addTeamToGraph(testGraph, i);
        }<commit_msg>Refactored the code for creating random graph.<commit_after>import java.util.ArrayList;
import java.util.Random;

public class BulkTest {

    private static final boolean PRINT_RESULTS = false;

    private static final int NUMBER_OF_TEAMS = 500;

    private static final int MIN_NUMBER_COACHES = 8;
    private static final int MAX_NUMBER_COACHES = 100;

    private static final int MIN_NUMBER_STUDENTS = 15;
    private static final int MAX_NUMBER_STUDENTS = 2500;

    private static final int MIN_NUMBER_COACHES_FOR_STUDENT = 1;
    private static final int MAX_NUMBER_COACHES_FOR_STUDENT = 8;


    private static int getRandom(int min, int max) {
        Random rand = new Random();
        return rand.nextInt((max - min) + 1) + min;
    }

    private static void addRandomTeamToGraph(UserGraph graph, int teamNumber) {
        User[] coaches = addCoachesToGraph(graph, teamNumber);
        addStudentsToGraph(graph, teamNumber, coaches);
    }

    private static User[] addCoachesToGraph(UserGraph graph, int teamNumber) {
        int numberOfCoaches = getRandom(MIN_NUMBER_COACHES, MAX_NUMBER_COACHES);
        User coaches[] = new User[numberOfCoaches];
        for (int i = 0; i < numberOfCoaches; i++) {
            coaches[i] = new User.Builder().build("Coach" + teamNumber + "_" + i);
            graph.addUser(coaches[i]);
        }
        return coaches;
    }

    private static void addStudentsToGraph(UserGraph graph, int teamNumber, User[] coaches) {
        int numberOfStudents = getRandom(MIN_NUMBER_STUDENTS, MAX_NUMBER_STUDENTS);
        for (int i = 0; i < numberOfStudents; i++) {
            User student = new User.Builder().build("Student" + teamNumber + "_" + i);
            addCoachesToStudent(coaches, student);
            graph.addUser(student);
        }
    }

    private static void addCoachesToStudent(User[] coaches, User student) {
        int studentCoachCount =  getRandom(MIN_NUMBER_COACHES_FOR_STUDENT, MAX_NUMBER_COACHES_FOR_STUDENT);
        for (int j = 0; j < studentCoachCount; j++) {
            student.addCoach(coaches[getRandom(0, coaches.length - 1)]);
        }
    }

    public static void main(String args[]) {
        UserGraph testGraph = new UserGraph.Builder().build();

        // Adds the specified number of random teams to the graph
        for (int i = 0; i < NUMBER_OF_TEAMS; i++) {
            addRandomTeamToGraph(testGraph, i);
        }
{'fraction_non_alphanumeric': 0.09371348445898574, 'fraction_numerical': 0.010282776349614395, 'mean_word_length': 2.923006416131989, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '1022303', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1271, 'n_words': 348}