#!/usr/bin/perl
#
# mksample.pl - erzeugt zufällige Eingabedateien für die Sprachübersicht
#               in Artikel "Babylon zu fünft" in Linux-Magazin 10/2008.
#
# Copyright (c) 2008 by Nils Magnus ([email protected])
#
# Veröffentlicht unter der GPL2.
#

$nn = 100; # Anzahl Fußnoten, war 100000 für Tests im Heft

@t = ();

@l = ();

foreach (1 .. $nn) {
   $f = int(rand($nn));
   unless ($t[$f] eq "true") {
       push(@l, $f);
       $t[$f] = "true";
   } else { print "************************ HIT! $f\n"; }

   print "abracadbra [$f] .... [ " if (($f % 3) == 0);
   print "[$f] .... [a]\n"         if (($f % 3) == 1);
   print "] foobar [$f] bo [[[[%"  if (($f % 3) == 2);
}

print "\n\n\@footnote:\n\n";
print "\n\n\@footnotes:\n\n";

while ($#l) {
   if ($l[0] % 2) {
       $a = shift(@l);
   } else {
       $a = pop(@l);
   }
   $i++;
   print "[$a] this is ref no $i.\n";
}