#!/usr/bin/perl
# jibberish -- run filters in random order

$ENV{PATH}.=":/usr/games";

@all= qw(
eleet
b1ff
chef
jethro
upside-down
kraut
cockney
jive
pirate
nyc
ken
ky00te
rasterman
newspeak
studly
censor
spammer
);

# shuffle order
srand;
for (0..$#all) {
	my $n= @all*rand;
	my $was= $all[$_];
	$all[$_]= $all[$n];
	$all[$n]= $was;
}

# start the pipe...
my $pipe= join '|', @all[0..3 + rand(5)];
open FILTER, "$pipe|"
	or die "Never mind...\n";

# display the results
while (<FILTER>) {
	print $_
}

# This could be optimized: take the last program off the pipeline,
# open the pipeline as standard input, then exec that last program.
#
# But you have to ask yourself: how important is it to optimize
# the generation of jibberish?
