{
    "mode": "info",
    "parameter": "Crypt::OpenSSL::Random",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/Crypt%3A%3AOpenSSL%3A%3ARandom/json",
    "generated": "2026-07-05T13:32:25Z",
    "synopsis": "use Crypt::OpenSSL::Random;\nCrypt::OpenSSL::Random::randomseed($goodrandomdata);\nCrypt::OpenSSL::Random::randomegd(\"/tmp/entropy\");\nCrypt::OpenSSL::Random::randomstatus() or\ndie \"Unable to sufficiently seed the random number generator\".\nmy $tengoodrandombytes = Crypt::OpenSSL::Random::randombytes(10);\nmy $tenokrandombytes = Crypt::OpenSSL::Random::randompseudobytes(10);",
    "sections": {
        "NAME": {
            "content": "Crypt::OpenSSL::Random - OpenSSL/LibreSSL pseudo-random number\ngenerator access\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Crypt::OpenSSL::Random;\n\nCrypt::OpenSSL::Random::randomseed($goodrandomdata);\nCrypt::OpenSSL::Random::randomegd(\"/tmp/entropy\");\nCrypt::OpenSSL::Random::randomstatus() or\ndie \"Unable to sufficiently seed the random number generator\".\n\nmy $tengoodrandombytes = Crypt::OpenSSL::Random::randombytes(10);\nmy $tenokrandombytes = Crypt::OpenSSL::Random::randompseudobytes(10);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"Crypt::OpenSSL::Random\" provides the ability to seed and query the\nOpenSSL and LibreSSL library's pseudo-random number generators.\n\nNote: On LibreSSL \"randomegd()\" is not defined.\n\nEXPORT\nNone by default.\n",
            "subsections": []
        },
        "Static Methods": {
            "content": "randombytes (IV numbytes)\nThis function, returns a specified number of cryptographically\nstrong pseudo-random bytes from the PRNG.  If the PRNG has not been\nseeded with enough randomness to ensure an unpredictable byte\nsequence, then a false value is returned.\n\nrandompseudobytes (IV numbytes)\nThis function, is similar to \"randombytes\", but the resulting\nsequence of bytes are not necessarily unpredictable.  They can be\nused for non-cryptographic purposes and for certain purposes in\ncryptographic protocols, but usually not for key generation etc.\n\nrandomseed (PV randombytesstring)\nThis function seeds the PRNG with a supplied string of bytes.  It\nreturns true if the PRNG has sufficient seeding.  Note: calling\nthis function with non-random bytes is of limited value at best!\n\nrandomegd (PV egdstring)\nThis function seeds the PRNG with data from the specified entropy\ngathering daemon.  Returns the number of bytes read from the daemon\non success, or \"-1\" if not enough bytes were read, or if the\nconnection to the daemon failed.\n\n\"libressl\" considers this function insecure, so with libressl this\nfunction does not exist.\n\nrandomstatus ()\nThis function returns true if the PRNG has sufficient seeding.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Because of the internal workings of OpenSSL's random library, the\npseudo-random number generator (PRNG) accessed by\nCrypt::OpenSSL::Random will be different than the one accessed by any\nother perl module.  Hence, to use a module such as\nCrypt::OpenSSL::Random, you will need to seed the PRNG used there from\none used here.  This class is still advantageous, however, as it\ncentralizes other methods, such as \"randomegd\", in one place.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Ian Robertson, \"iroberts@cpan.com\"\n\nNow maintained by Reini Urban, \"rurban@cpan.org\"\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This module is available under the same licences as perl, the Artistic\nlicense and the GPL.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl(1), rand(3), RANDadd(3), RANDegd(3), RANDbytes(3).\n\nperl v5.34.0                      2022-02-06                       Random(3pm)",
            "subsections": []
        }
    },
    "summary": "Crypt::OpenSSL::Random - OpenSSL/LibreSSL pseudo-random number generator access",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "perl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/perl/1/json"
        },
        {
            "name": "rand",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rand/3/json"
        },
        {
            "name": "RANDadd",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/RANDadd/3/json"
        },
        {
            "name": "RANDegd",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/RANDegd/3/json"
        },
        {
            "name": "RANDbytes",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/RANDbytes/3/json"
        }
    ]
}