I used "shuf" and "sort -R" to shuffle the music playlist, but it seems that some songs play more than others.
To check this, I used the following command, which shuffles the alphabet and writes the 1st letter in random order, repeats x1000, and then counts the number of times each letter was selected. If this were truly random, there would be a uniform distribution, but it was always one-sided:
printf "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz" > alphabet.txt; for i in {1..1000}; do cat alphabet.txt | perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | perl -e 'print reverse <>' | head -1 >> results.txt; done; sort results.txt | uniq -c | sort; rm results.txt; rm alphabet.txt
This leads to something like:
29 w
30 u
31 d
32 i
33 v
34 c
34 m
36 a
36 g
36 k
36 n
36 r
36 z
38 y
39 x
40 b
40 e
40 o
42 p
43 f
43 h
43 s
44 j
44 l
52 q
53 t
Please note that “t” is selected 53 times, but “w” is only 29. I believe that the songs that I hear most often are like “t” and there are songs that I rarely get in the mix (for example, “ )
- Bash/Perl/Python/etc, / ?