Skip to content

Instantly share code, notes, and snippets.

@zigdon
Created August 14, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zigdon/3353718 to your computer and use it in GitHub Desktop.
Save zigdon/3353718 to your computer and use it in GitHub Desktop.
--- rainbow.pl 2012-08-14 15:41:11.152540000 -0700
+++ rainbox.orig.pl 2012-08-14 15:54:49.358372000 -0700
@@ -62,10 +62,10 @@
$newstr .= $char;
next;
}
-
- $color++;
+ while (($color = int(rand(scalar(@colors)))) == $last) {};
+ $last = $color;
$newstr .= "\003";
- $newstr .= sprintf("%02d", $colors[$color % @colors]);
+ $newstr .= sprintf("%02d", $colors[$color]);
$newstr .= (($char eq ",") ? ",," : $char);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment