use strict; use warnings; use Math::Random::MT::Auto::Range; binmode(STDOUT, ":utf8"); $| = 1; #the following exhausts all memory #my $all = join q[], grep /^\w$/, map chr, shuffle 0 .. 0x10FFFF; #print $all,"\n"; # # so I tried: my @chars = map(chr, 0 .. 0x10FFFF); my $rng = Math::Random::MT::Auto::Range->new(LO => 0, HI => 0x10FFFF, TYPE => 'INTEGER'); # three options for doing the basically the same thing for (my $i = 0 ; $i < 10 ; $i++) { my $code = $rng->rrand; print "$i <=> $code <=>",chr($code),"\n"; print "\t$i <=> $code <=>",$chars[$code],"\n"; print "\t$i <=> $code <=>",pack("U",$code),"\n"; }