<commit_before>from numpy.random import ranf

__all__ = ('rand_unit_complex', 'rand_unit_shifted')


def rand_unit_complex(shape, ftype='double'):
    return ranf(shape).astype(ftype) + 1j * ranf(shape).astype(ftype)


def rand_unit_shifted(shape, ftype='double'):
    return ranf(shape).astype(ftype) - 0.5<commit_msg>Add docstrings to the util API<commit_after>"""Common utility functions."""
from numpy.random import ranf

__all__ = ('rand_unit_complex', 'rand_unit_shifted')


def rand_unit_complex(shape, ftype='double'):
    """Return random complex values in the [0, 1) interval.

    Parameters
    ----------
    shape : int or sequence of ints
        Output shape. For instance, if the shape is ``(m, n)``, then ``m * n``
        samples are drawn.
    ftype : str or dtype, optional
        Output float type. Choose between 'single', 'double', or 'longdouble'.
        Default is 'double', in which case the output array will be composed of
        128-bit complex floats.

    Returns
    -------
    out : ndarray of complex floats
    """
    return ranf(shape).astype(ftype) + 1j * ranf(shape).astype(ftype)


def rand_unit_shifted(shape, ftype='double'):
    """Return random values in the [-0.5, 0.5) interval.

    Parameters
    ----------
    shape : int or sequence of ints
        Output shape. For instance, if the shape is ``(m, n)``, then ``m * n``
        samples are drawn.
    ftype : str or dtype, optional
        Output float type. Choose between 'single', 'double', or 'longdouble'.
        Default is 'double', in which case the output array will be composed of
        64-bit floats.

    Returns
    -------
    out: ndarray of floats
    """
    return ranf(shape).astype(ftype) - 0.5
{'fraction_non_alphanumeric': 0.13008130081300814, 'fraction_numerical': 0.009872241579558653, 'mean_word_length': 2.854586129753915, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7076271', 'n_tokens_mistral': 539, 'n_tokens_neox': 517, 'n_words': 180}