tongues
#!/bin/bash
# Define the file containing characters
CHAR_FILE="god.txt"
# Function to generate a random number within a given range
random_number() {
min=$1
max=$2
echo $(($min + RANDOM % ($max - $min + 1)))
}
# Function to generate a random word
generate_word() {
word_length=$(random_number 3 10) # Random word length between 3 and 10 characters
word=""
for ((i=0; i<$word_length; i++)); do
# Select a random character from the character file
start_pos=$(random_number 1 $(wc -c < "$CHAR_FILE"))
char=$(dd if="$CHAR_FILE" bs=1 skip=$((start_pos - 1)) count=1 2>/dev/null)
word="$word$char"
done
echo "$word"
}
# Function to generate a random sentence
generate_sentence() {
# Determine a random number of words
num_words=$(random_number 1 20)
sentence=""
# Generate the sentence by selecting random words
for ((i=0; i<$num_words; i++)); do
# Generate a random word
word=$(generate_word)
# Append the word to the sentence
sentence="$sentence $word"
done
# Capitalize the first letter of the sentence and add a period
sentence=$(echo "$sentence" | sed 's/^\(.\)/\U\1/')"."
echo "$sentence"
}
# Main function
main() {
# Generate and output the random sentence
generate_sentence
}
# Run the main function
main
INFO