markov - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
markov (800B)
---
1 #!/bin/sh
2
3 BASE="$HOME/bin/modules/markov_french"
4
5 VERB="${BASE}/verbs"
6 NOUN="${BASE}/nouns"
7 ADJ="${BASE}/adjectives"
8
9 ## function
10 rand(){
11 max="$1"
12 if [ -z "$max" ] || [ "$max" -lt 1 ]; then
13 max=2;
14 fi
15 r=$(echo "$(od -An -N2 -i /dev/urandom) % $max" | bc)
16 echo "$r"
17 }
18
19 verb1="$(shuf "${VERB}" | head -1)"
20 verb2="$(shuf "${VERB}" | head -1)"
21 while [ "$verb1" = "$verb2" ]; do
22 verb2="$(shuf "${VERB}" | head -1)"
23 done
24
25 noun1="$(shuf "${NOUN}" | head -1)"
26 noun2="$(shuf "${NOUN}" | head -1)"
27 while [ "$noun1" = "$noun2" ]; do
28 noun2="$(shuf "${NOUN}" | head -1)"
29 done
30
31 adj1="$(shuf "${ADJ}" | head -1)"
32 adj2="$(shuf "${ADJ}" | head -1)"
33 while [ "$adj1" = "$adj2" ]; do
34 adj2="$(shuf "${ADJ}" | head -1)"
35 done
36
37 res="$verb1 $noun1 $adj1 et $verb2 $noun2 $adj2"
38
39 echo "Pour votre sécurité, $res"
40