<commit_before># Return a list of repeated shuffles of the input list by building and
# running a python script. The length of the result is the first argument
# to the fn. This funcion is only used to build the list of emoji at the
# start of a new terminal, when this file is sourced. From then on, emoji
# are simply chosen from those pre-shuffled lists.
SHUFFLE_LIST() {
    local num=$(( 0 + $1 ))  # error here, not python
    shift

    local things=($@)
    if (( ${#things[@]} == 0 )); then
        echo ''
    else
        local PY
        read -d '' PY <<EOF
# -*- coding: UTF-8 -*-
import random
e='${things[@]}'.strip().split()
all=[]
while len(all) < $num:
    random.shuffle(e)
    all += e
print ' '.join(all[:$num])
EOF
        echo $(echo "$PY" | python)
    fi
}

# Pick an element based on time & pid of current shell ($$). It changes every
# hour, and is different for each shell.
RAND_ELEMENT_BY_TIME () {
    # Put the args into a named list, so we can use it as an array
    local things=($@)

    local len=${#things[@]}
    if (( $len == 0 )); then
        echo ''
    else<commit_msg>Make compatible w python 2 & 3<commit_after># Return a list of repeated shuffles of the input list by building and
# running a python script. The length of the result is the first argument
# to the fn. This funcion is only used to build the list of emoji at the
# start of a new terminal, when this file is sourced. From then on, emoji
# are simply chosen from those pre-shuffled lists.
SHUFFLE_LIST() {
    local num=$(( 0 + $1 ))  # error here, not python
    shift

    local things=($@)
    if (( ${#things[@]} == 0 )); then
        echo ''
    else
        local PY
        read -d '' PY <<EOF
# -*- coding: UTF-8 -*-
from __future__ import print_function
import random
e='${things[@]}'.strip().split()
all=[]
while len(all) < $num:
    random.shuffle(e)
    all += e
print(' '.join(all[:$num]))
EOF
        echo $(echo "$PY" | python)
    fi
}

# Pick an element based on time & pid of current shell ($$). It changes every
# hour, and is different for each shell.
RAND_ELEMENT_BY_TIME () {
    # Put the args into a named list, so we can use it as an array
    local things=($@)

    local len=${#things[@]}
    if (( $len == 0 )); then
        echo ''
    else
{'fraction_non_alphanumeric': 0.12949956101843724, 'fraction_numerical': 0.0052677787532923615, 'mean_word_length': 2.7607260726072607, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4068950', 'n_tokens_mistral': 728, 'n_tokens_neox': 709, 'n_words': 316}