I'm setting up a login system and when a new user is created, I need to generate a salt to be used when hashing their password. I'm using MySQL, which can apparently store 3-byte UTF8, so should I use that or just stick to ASCII? Is there a better way to get random characters? Here's what I have so far:
my @characters;
push @characters, chr(int(rand() * 16777215 + .5)) for 1..10;
my $salt = join('', @characters);