<commit_before>""" Utility functions
"""
import random
import time
from . import constants

def _service_url_from_hostport(secure, host, port):
    """
    Create an appropriate service URL given the parameters.

    `secure` should be a bool.
    """
    if secure:
        protocol = 'https://'
    else:
        protocol = 'http://'
    return ''.join([protocol, host, ':', str(port), '/_rpc/v1/reports/binary'])

def _generate_guid():
    """
    Construct a guid - random 64 bit integer converted to a string.
    """
    return str(random.getrandbits(64))
<commit_msg>Use a private RNG for guids. Avoids potential for trouble w/ the global instance.<commit_after>""" Utility functions
"""
import random
import time
from . import constants

guid_rng = random.Random()   # Uses urandom seed

def _service_url_from_hostport(secure, host, port):
    """
    Create an appropriate service URL given the parameters.

    `secure` should be a bool.
    """
    if secure:
        protocol = 'https://'
    else:
        protocol = 'http://'
    return ''.join([protocol, host, ':', str(port), '/_rpc/v1/reports/binary'])

def _generate_guid():
    """
    Construct a guid - random 64 bit integer converted to a string.
    """
    return str(guid_rng.getrandbits(64))

{'fraction_non_alphanumeric': 0.1277602523659306, 'fraction_numerical': 0.007886435331230283, 'mean_word_length': 3.0673076923076925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '609408', 'n_tokens_mistral': 386, 'n_tokens_neox': 371, 'n_words': 126}