Bytes::Random::XS - Perl extension to generate random bytes.
use Bytes::Random::XS qw/random_bytes/;
my $bytes = random_bytes( $number_of_bytes );
This module provides the random_bytes function which allows you to generate specified number of random bytes. It uses exactly the same algorithm as Bytes::Random, but it's implemented in XS, so it's much faster (see "BENCHMARKS" section).
Comparison of Bytes::Random and Bytes::Random::XS performance:
Rate B::R@0.02 B::R::X@0.01
B::R@0.02 45903/s -- -97%
B::R::X@0.01 1462857/s 3087% --
Nothing is exported by default. random_bytes is an optional export.
This module is not intended to be cryptographically secure. If that concerns you, consider using Bytes::Random::Secure instead.
Bytes::Random::XS is an XS module, which means it's not compatible with App::FatPacker. Bytes::Random is a pure Perl alternative that doesn't have this problem.
Bytes::Random::XS repository is hosted at github:
Bytes::Random - pure Perl version of the module.
Bytes::Random::Secure - cryptographically secure way to generate random bytes.
Tomasz Konojacki <email@example.com>
Copyright (C) 2017 by Tomasz Konojacki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.0 or, at your option, any later version of Perl 5 you may have available.
To install Bytes::Random::XS, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.