From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

#! perl
use strict;
use Crypt::SysRandom 'random_bytes';
my $first = random_bytes(16);
is length $first, 16, '$first is 16 bytes';
isnt $first, scalar("\0" x 16), "\$first isn't empty";
my $second = random_bytes(16);
isnt $first, $second, "\$first isn't second";
done_testing;