#!/usr/bin/perl open(FILE, $ARGV[0]) || die $!; open(OUT, ">$ARGV[1]") || die $!; $mutation_chance = 0.20; $mutation_allowed = 1; while() { next if (/^\s*$/); if (/^\s*#/) { $mutation_allowed = 1 if (/^#\s*BEGIN MUTATION ALLOWED/); $mutation_allowed = 0 if (/^#\s*END MUTATION ALLOWED/); print OUT; next; } $should_mutate = rand() < $mutation_chance; $mutation_amount = (rand() - 0.5) / 2.7; if (($should_mutate) && ($mutation_allowed)) { @arr = split(/,/); for $a (@arr) { $x = ($a * $mutation_amount); $x += $a; $x = int($x); print OUT "$x,"; } print OUT "\n"; } else { print OUT; } } exit 0;