The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::RandomOrg - Retrieve random numbers and data from random.org.

SYNOPSIS

  use Math::RandomOrg qw(randnum randbyte);
  my $number = randnum(0, 10);
  my $octet = randbyte(1);

DESCRIPTION

Math::RandomOrg provides functions for retrieving random data from the random.org server. Data may be retrieved in an integer or byte-stream format using the randnum and randbyte functions respectively.

REQUIRES

Carp
Exporter
Math::BigInt
LWP::Simple

EXPORT

None by default. You may request the following symbols be exported:

  • randnum

  • randbyte

FUNCTIONS

randnum ( $min, $max )

Return an integer (specifically a Math::BigInt object) between the bounds [ $min, $max ] (inclusive).

By default, $max and $min are positive and negative 1e9, respectively. These default values represent random.org's current extrema for the bounds of the randnum function. Therefore, $min and $max may not exceed the default values.

randbyte ( $length )

Returns an octet-string of specified length (defaults to one byte), which contains random bytes.

$length may not exceed 16,384, as this is the maximum number of bytes retrievable from the random.org server in one request, and making multiple requests for an unbounded amount of data would unfairly tax the random.org server. If you need large amounts of random data, you may wish to try the Math::TrulyRandom module.

BUGS

None known.

AUTHOR

Gregory Williams <greg@evilfunhouse.com>

SEE ALSO

COPYRIGHT

Copyright (c) 2002, Gregory Williams. All rights reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.