Net::Random

Net::Random is a Perl module to get random data from online sources.
Download

Net::Random Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David Cantrell
  • Publisher web site:
  • http://search.cpan.org/~dcantrell/

Net::Random Tags


Net::Random Description

Net::Random is a Perl module to get random data from online sources. Net::Random is a Perl module to get random data from online sources.SYNOPSIS my $rand = Net::Random->new( # use fourmilab.ch's randomness source, src => 'fourmilab.ch', # and return results from 1 to 2000 min => 1, max => 2000 ); @numbers = $rand->get(5); # get 5 numbers my $rand = Net::Random->new( # use random.org's randomness source, src => 'random.org', # with no explicit range - so values will ); # be in the default range from 0 to 255 $number = $rand->get(); # get 1 random numberMETHODSnew The constructor returns a Net::Random object. It takes named parameters, of which one - 'src' - is compulsory, telling the module where to get its random data from. The 'min' and 'max' parameters are optional, and default to 0 and 255 respectively. Both must be integers, and 'max' must be at least min+1. The maximum value of 'max' is 2^32-1, the largest value that can be stored in a 32-bit int, or 0xFFFFFFFF. The range between min and max can not be greater than 0xFFFFFFFF either. Currently, the only valid values of 'src' are 'fourmilab.ch' and 'random.org'.get Takes a single optional parameter, which must be a positive integer. This determines how many random numbers are to be returned and, if not specified, defaults to 1. If it fails to retrieve data, we return undef. Note that both sources ration their random data. If you hit your quota, we spit out a warning. See the section on ERROR HANDLING below.Requirements:· Perl Requirements: · Perl


Net::Random Related Software