Data::E...e::Local(3)
π Data::Entropy::RawSource::Local β the tea β
okay bestie, so this is Data::Entropy::RawSource::Local(3), a page from the User Contributed Perl Documentation, and it's literally all about pulling raw randomness out of a local device. let's get into it π
β¨ NAME β¨
Data::Entropy::RawSource::Local β read randomness from a local device π²
πΈ SYNOPSIS πΈ
use Data::Entropy::RawSource::Local;
my $rawsrc = Data::Entropy::RawSource::Local->new;
$rawsrc->sysread($c, 1);
# and the rest of the I/O handle interface
π¦ DESCRIPTION π¦
so basically, this class gives you a constructor that opens an I/O handle wired up to a local source of random octets. it may be a strong entropy source depending on your OS β but ngl, not every OS even has a facility like this at all. π
also, fun fact: there are no actual objects blessed into this class. only the constructor belongs here, and what it hands back are IO::File objects. and if you want to use it as a general entropy source, the move is to wrap that handle using Data::Entropy::Source β that one gives you methods to pull entropy out in way more convenient forms than just plain octets. π«Ά
on systems with a blocking /dev/random, like Linux, the bits generated can be totally unbiased and uncorrelated. that kind of entropy stream is suitable for all uses, including security applications. iconic. π but β and this is the catch β the rate of entropy generation is limited, so if your app needs a large amount of apparently-random data, you might prefer to fake it cryptographically (peep Data::Entropy::RawSource::CryptCounter). β¨
on systems where /dev/random does not block, the bits generated are necessarily correlated to some extent, but it should be cryptographically difficult to detect that correlation. that kind of entropy source is not suitable for all applications, so watch out. π and some other systems just straight up lack /dev/random entirely. not the vibe.
π CONSTRUCTOR π
Data::Entropy::RawSource::Local->new([FILENAME])β opens a file handle referring to the randomness device, ordies on error. the device opened is/dev/randomby default, but you can override that by passing a FILENAME argument.
heads up bestie: the default device name may in the future be different on different OSes, if their equivalent devices are in different places. so don't get too attached to the path, okay? π
β METHODS β
there are no actual objects blessed into this class. the constuctor returns IO::File objects. see IO::File for the interface.
and the recommendation: use unbuffered reads (the sysread method) rather than buffered reads (the getc method et al), so you avoid wasting entropy that could be used by another process. fr fr, don't be wasteful with the randomness π
π SEE ALSO π
Data::Entropy::RawSource::CryptCounterData::Entropy::RawSource::RandomOrgData::Entropy::RawSource::RandomnumbersInfoData::Entropy::SourceIO::File
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org>
Maintained by Robert Rothenberg <perl@rhizomnic.com>
πΈ COPYRIGHT πΈ
Copyright (C) 2006, 2007, 2009, 2011, 2025-2026 Andrew Main (Zefram) <zefram@fysh.org>
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π this was perl v5.42.3, dated 2026-08-02, served fresh from Data::E...e::Local(3) β periodt. π
β¨
π¦ where this page comes from
- fedora 43: perl-Data-Entropy 0.010-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Data-Entropy 0.010-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms