libwget-random(3)

πŸ’– libwget-random β€” Random functions πŸ’–

okay bestie, sit down, hydrate, because we're talking about libwget-random, aka the Library Functions Manual entry for the wget2 randomness girlies. it's giving dice-roll energy, it's giving "trust the vibes, they're seeded". let's go 🎲✨


🌈 NAME 🌈

libwget-random β€” Random functions. that's it, that's the whole identity. random functions, no notes. πŸ’…


✨ SYNOPSIS ✨

🫢 Functions

here's the whole cast, no skips, no cuts:

INITIALIZER (random_init)
void wget_random_init (void)
void wget_random_exit (void)
int wget_random (void)
void wget_srandom (unsigned int seed)

look at them. icons. every single one of them shows up later, so don't scroll past. πŸ‘‘


πŸ¦‹ Detailed Description πŸ¦‹

so basically this is wrapper code around gnulib's srandom_r() and random_r() with automatic seeding. that's the whole tea. it doesn't reinvent randomness, it just wraps the gnulib ones up in a lil bow πŸŽ€ and handles the seeding for you automatically. no cap.


🌸 Function Documentation 🌸

πŸ’œ void wget_random_init (void )

Random API initialization β€” it's allocating/preparing the internal resources. the pre-game ritual, the getting-ready-with-me. πŸ’„

lowkey important detail: on systems with automatic library constructors, this function doesn't have to be called explicitly. the system already did it for you, bestie, it's self-sufficient like that.

⚠️ This function is not thread-safe. do not come for it in a crowd, she will not handle it. πŸ’€

🧚 void wget_random_exit (void )

Random API deinitialization β€” it's free'ing all internal resources. the skincare routine after the party, the cleanup era. 🧼

and same deal as her sister: on systems with automatic library destructors, this function doesn't have to be called explicitly. the system handles the goodbye on its own. 🫢

⚠️ This function is not thread-safe. periodt. one at a time please.

⭐ int wget_random (void )

the main character!! 🌟

Returns

Random value between 0 and RAND_MAX. yes, that RAND_MAX. iconic range, honestly.

and here's the lore: this functions wraps around gnulib's random_r(). it performs a thread-safe seeding on the first use, if not done before by wget_srandom(). so if you forgot to seed it yourself, she's got you β€” first use, seeded, thread-safe, done. no drama. πŸ”₯


πŸ“ void wget_srandom (unsigned int seed)

the seeding girlie. 🌱

Parameters

  • seed β€” Value to seed the random generator. that's the lil number you hand over so everything after it isn't the same sequence every single time. choose wisely, or don't, it's random anyway. πŸ™ˆ

and the vibe: this functions wraps around srandom_r() to make a thread-safe seeding for wget_random(). so it's not just seeding, it's seeding responsibly. πŸ’…


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for wget2 from the source code. the manpage wrote itself, literally, and honestly? slay. ✨


and that's the whole page, bestie!! πŸ’– this was brought to you by wget2, Version 2.3.0, living under the libwget-random(3) name β€” go forth and be random, thread-safely, one call at a time. bye mwah πŸŽ€πŸŒˆπŸ¦‹

πŸ“¦ where this page comes from