{"id":17528217,"url":"https://github.com/mauke/sys-getrandom","last_synced_at":"2025-04-03T03:23:48.026Z","repository":{"id":65786795,"uuid":"599823856","full_name":"mauke/Sys-GetRandom","owner":"mauke","description":"Sys::GetRandom - Perl interface to getrandom(2)","archived":false,"fork":false,"pushed_at":"2023-02-10T00:59:35.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-08-09T12:16:58.464Z","etag":null,"topics":["getrandom","perl","perl-module","random"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauke.png","metadata":{"files":{"readme":".github/README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-10T00:31:20.000Z","updated_at":"2023-02-10T00:33:12.000Z","dependencies_parsed_at":"2023-02-21T02:16:07.536Z","dependency_job_id":null,"html_url":"https://github.com/mauke/Sys-GetRandom","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauke%2FSys-GetRandom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauke%2FSys-GetRandom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauke%2FSys-GetRandom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauke%2FSys-GetRandom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauke","download_url":"https://codeload.github.com/mauke/Sys-GetRandom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246929083,"owners_count":20856408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["getrandom","perl","perl-module","random"],"created_at":"2024-10-20T15:28:31.048Z","updated_at":"2025-04-03T03:23:47.998Z","avatar_url":"https://github.com/mauke.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nSys::GetRandom - Perl interface to getrandom(2)\n\n# SYNOPSIS\n\n```perl\nuse Sys::GetRandom qw(getrandom random_bytes GRND_NONBLOCK GRND_RANDOM);\nmy $n = getrandom($buf, $count, $flags, $offset);\nmy $bytes = random_bytes($count);\n```\n\n# DESCRIPTION\n\nThis module provides a Perl interface to the [getrandom(2)](http://man.he.net/man2/getrandom) call present on\nLinux and FreeBSD. It exports (on request) two functions and two constants.\n\n## Functions\n\n- getrandom SCALAR, LENGTH\n- getrandom SCALAR, LENGTH, FLAGS\n- getrandom SCALAR, LENGTH, FLAGS, OFFSET\n\n    Generates up to _LENGTH_ bytes of random data and stores them in _SCALAR_.\n    Returns the number of random bytes generated, or `undef` on error (in which\n    case `$!` is also set).\n\n    By default, `getrandom` is equivalent to reading from `/dev/urandom` (but\n    without accessing the file system or requiring the use of a file descriptor).\n    If `/dev/urandom` has not been initialized yet, `getrandom` will block by\n    default.\n\n    If `/dev/urandom` has been initialized and _LENGTH_ is 256 or less,\n    `getrandom` will atomically return the requested amount of random data (i.e.\n    it will generate exactly _LENGTH_ bytes of data and will not be interrupted by\n    a signal). For larger values of _LENGTH_ it may be interrupted by signals and\n    either generate fewer random bytes than requested or fail with `$!` set to\n    `EINTR`.\n\n    The _FLAGS_ argument must be either 0 (the default value) or the bitwise OR of\n    one or more of the following flags:\n\n    - `GRND_RANDOM`\n\n        Read from the same source as `/dev/random`, not `/dev/urandom` (the default).\n\n    - `GRND_NONBLOCK`\n\n        By default, `getrandom` will block if `/dev/urandom` has not been initialized\n        yet or (with `GRND_RANDOM`) if there are no random bytes available in\n        `/dev/random`. If the `GRND_NONBLOCK` flag is passed, it will fail\n        immediately instead, returning `undef` and setting `$!` to `EAGAIN`.\n\n    By default, the generated bytes are placed at the beginning of _SCALAR_. You\n    can pass a positive value for _OFFSET_ to place them within the string,\n    leaving the first _OFFSET_ bytes unchanged.\n\n- random\\_bytes LENGTH\n\n    Generates and returns a string of _LENGTH_ random bytes.\n\n    _LENGTH_ must be between 0 and 256 (inclusive).\n\n    This is just a wrapper around `getrandom` with default flags.\n\n# AUTHOR\n\nLukas Mai, `\u003clmai at web.de\u003e`\n\n# COPYRIGHT \u0026 LICENSE\n\nCopyright 2023 Lukas Mai.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of either: the GNU General Public License as published\nby the Free Software Foundation; or the Artistic License.\n\nSee [https://dev.perl.org/licenses/](https://dev.perl.org/licenses/) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauke%2Fsys-getrandom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauke%2Fsys-getrandom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauke%2Fsys-getrandom/lists"}