prandom_bytes_state(9)
π« prandom_bytes_state(9) β Kernel API Manual, but make it a group chat π«
okay bestie, so this one is prandom_bytes_state(9) β that's the whole title, we're not doing the boring header line, you're welcome β¨. It lives in the Kernel API Manual and it's genuinely so useful once it clicks, I promise π«Ά
πΈ NAME πΈ
prandom_bytes_state β get the requested number of pseudo-random bytes. that's it, that's the whole vibe. it gives you random-ish bytes, and you tell it how many π
π SYNOPSIS π
void prandom_bytes_state (struct rnd_state *state , void *buf , size_t
bytes );
literally just drop that in and you're golden β¨
π¦ ARGUMENTS π¦
stateβ pointer to state structure holding seeded state. so like, this is the lil container that's already been seeded, and you're handing it over so it knows what to work with π§bufβ where to copy the pseudo-random bytes to. it's the destination, the place the bytes go to live π‘bytesβ the requested number of bytes. how many you want, bestie, you decide π
π DESCRIPTION π
okay so the actual tea β: this is used for pseudo-randomness with no outside seeding. no cap, that's the whole deal β you're not bringing in fresh entropy from anywhere outside, it's just working off what's already in there π
and like, if you want more random results? use get_random_bytes. simple as that. that's the upgrade path, iykyk π
bestie heads up β "pseudo-random" is doing real work in that sentence. it's giving predictable-if-you-know-the-state, not it's-giving-cryptographic. the manpage literally points you at get_random_bytes for more random results, so take the hint fr fr π
β SEE ALSO β
- Kernel file
./lib/random32.cπ prandom_u32_state(9)β the 32-bit cousin, iconic behaviour π«
and that's the page!! π
sign-off time π β this lil masterpiece comes from ./lib, dated October 2026, and the version tag at the bottom? also prandom_bytes_state(9) because we keep it consistent, periodt π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms