Data-Rand
view release on metacpan or search on metacpan
lib/Data/Rand.pm view on Meta::CPAN
=item * 'get_random_index'
This should be a code ref that accepts one argument, the number of items we have to choose from, and returns an index chosen at random (however you choose to define "random")
sub {
my ($length) = @_;
return Crypt::Random::makerandom_itv( 'Lower' => 0, 'Upper' => $length, ...);
}
Note: The above example (w/ Strong => 0 (IE read() is not being blocked on /dev/random)) benchmarked appx 570 times as slow as the default L<rand>() based solution but its much more truly random.
=back
=back
=head2 rand_data_string()
Same args as rand_data(). The difference is that it always returns a string regardless of context.
my $rand_str = rand_data_string( @rand_args ); # $rand_str contains the random string.
( run in 0.795 second using v1.01-cache-2.11-cpan-49f99fa48dc )