<commit_before>'''
gmod_mapcycle_rand.py

This program randomizes the mapcycle for any gmod server.
Put this file in the root of your server directory and run it using:
    python3.5 gmod_mapcycle_rand.py
If that doesn't work, see the README.md for details in installing
The mapcycle of gmod (mapcycle.txt) comes part of just about every gmod server by default.
It is stored in /garrysmod/cfg/mapcycle.txt
'''
import random

# Shuffles a list while ignoring comments (//)
def shuffle(list):
    # Allowed indexes is the line numbers that are not commented out
    allowedIndexes = []
    # go through and put the indexes of the lines in the list
    # that do not start with //
    for i in range(len(list)):
        currentLine = list[i]
        if (currentLine.find('//') == -1):
            allowedIndexes.append(i)
    # randomize!
    for i in range(len(allowedIndexes)):
        # Choose random index within the allowed indexes
        currentLineIndex = allowedIndexes[i]
        otherLineIndex = allowedIndexes[int(random.randrange(0, len(allowedIndexes) - 1))]
        # Swap the the other line with the current line
        hold = list[currentLineIndex]
        list[currentLineIndex] = list[otherLineIndex]
        list[otherLineIndex] = hold
    return list


mapCycleOpenedSuccessfully = False
mapcycleDefaultPath = "garrysmod/cfg/mapcycle.txt"
lines = []

#Intro
print("*** GMOD mapcycle randomizer by <NAME> (https://github.com/duecknoah) ***")

# Get user to decide how to open map
while (not mapCycleOpenedSuccessfully):
    mapcyclePath = input("File name (with file path and extension) of mapcycle: (default: {}) ".format(mapcycleDefaultPath))<commit_msg>Made intro line have a link to the repo directly<commit_after>'''
gmod_mapcycle_rand.py

This program randomizes the mapcycle for any gmod server.
Put this file in the root of your server directory and run it using:
    python3.5 gmod_mapcycle_rand.py
If that doesn't work, see the README.md for details in installing
The mapcycle of gmod (mapcycle.txt) comes part of just about every gmod server by default.
It is stored in /garrysmod/cfg/mapcycle.txt
'''
import random

# Shuffles a list while ignoring comments (//)
def shuffle(list):
    # Allowed indexes is the line numbers that are not commented out
    allowedIndexes = []
    # go through and put the indexes of the lines in the list
    # that do not start with //
    for i in range(len(list)):
        currentLine = list[i]
        if (currentLine.find('//') == -1):
            allowedIndexes.append(i)
    # randomize!
    for i in range(len(allowedIndexes)):
        # Choose random index within the allowed indexes
        currentLineIndex = allowedIndexes[i]
        otherLineIndex = allowedIndexes[int(random.randrange(0, len(allowedIndexes) - 1))]
        # Swap the the other line with the current line
        hold = list[currentLineIndex]
        list[currentLineIndex] = list[otherLineIndex]
        list[otherLineIndex] = hold
    return list


mapCycleOpenedSuccessfully = False
mapcycleDefaultPath = "garrysmod/cfg/mapcycle.txt"
lines = []

#Intro
print("*** GMOD mapcycle randomizer (https://github.com/duecknoah/gmod-mapcycle-randomizer) ***")

# Get user to decide how to open map
while (not mapCycleOpenedSuccessfully):
    mapcyclePath = input("File name (with file path and extension) of mapcycle: (default: {}) ".format(mapcycleDefaultPath))
{'fraction_non_alphanumeric': 0.08858151854031783, 'fraction_numerical': 0.002942907592701589, 'mean_word_length': 3.5870445344129553, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '5591679', 'n_tokens_mistral': 998, 'n_tokens_neox': 982, 'n_words': 362}