---
name: "libwget-random"
section: "3"
platform: "linux"
package: "wget2-dev"
version: "2.2.0+ds-1+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libwget-random"
---

# libwget-random(3)

Random functions

## NAME

libwget-random - Random functions

## SYNOPSIS

### Functions

**INITIALIZER** (random\_init)\
 void **wget\_random\_init** (void)\
 void **wget\_random\_exit** (void)\
 int **wget\_random** (void)\
 void **wget\_srandom** (unsigned int seed)\

## Detailed Description

This is wrapper code around gnulib's srandom\_r() and random\_r() with automatic seeding

## Function Documentation

### void wget\_random\_init (void)

Random API initialization, allocating/preparing the internal resources.

On systems with automatic library constructors, this function doesn't have to be called explicitly.

This function is not thread-safe.

### void wget\_random\_exit (void)

Random API deinitialization, free'ing all internal resources.

On systems with automatic library destructors, this function doesn't have to be called explicitly.

This function is not thread-safe.

### int wget\_random (void)

**Returns**

Random value between 0 and RAND\_MAX

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()**;

### void wget\_srandom (unsigned int seed)

**Parameters**

*seed* Value to seed the random generator

This functions wraps around srandom\_r() to make a thread-safe seeding for **wget\_random()**.

## Author

Generated automatically by Doxygen for wget2 from the source code.
