in reply to Random Color Generator

Greetings, esteemed monks!

Pretty sweet. For generating just one random color, I used

my @ca=('0','3','6','9','C','E'); my @bgc=('','',''); foreach my $c (@bgc){ $r=int(rand(6)); $c=$ca[$r].$ca[$r]; } my $bgc=join("",@bgc);

_________________________________________________________________________________

I like computer programming because it's like Legos for the mind.

Replies are listed 'Best First'.
Re^2: Random Color Generator
by shibu_pu (Acolyte) on Jun 06, 2013 at 11:17 UTC
    my ($red, $green, $blue) = (int(rand(255)), int(rand(255)), int(rand(2 +55))); print qq{<div style="background-color: rgb($red, $green, $blue);"></di +v>};
      Or, if you do not want to repeat yourself:
      my ($red, $green, $blue) = map int rand 255, 1 .. 3;
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        A golfer, I see.