---
name: "ldns_init_random"
section: "3"
platform: "linux"
package: "ldns"
version: "1.9.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ldns_init_random"
---

# ldns\_init\_random(3)

seed the random function

## NAME

ldns\_init\_random - seed the random function

## SYNOPSIS

\#include \<stdint.h\>\
 \#include \<stdbool.h\>\

\#include \<ldns/ldns.h\>

int ldns\_init\_random(FILE \*fd, unsigned int size);

## DESCRIPTION

*ldns\_init\_random*() Seed the random function. If the file descriptor is specified, the random generator is seeded with data from that file. If not, /dev/urandom is used.

applications should call this if they need entropy data within ldns If openSSL is available, it is automatically seeded from /dev/urandom or /dev/random.

If you need more entropy, or have no openssl available, this function MUST be called at the start of the program

If openssl \*is\* available, this function just adds more entropy

.br **fd**: a file providing entropy data for the seed .br **size**: the number of bytes to use as entropy data. If this is 0, only the minimal amount is taken (usually 4 bytes) .br Returns 0 if seeding succeeds, 1 if it fails

## AUTHOR

The ldns team at NLnet Labs.

## REPORTING BUGS

Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues

## COPYRIGHT

Copyright (c) 2004 - 2006 NLnet Labs.

Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO

*ldns\_sign\_public*, *ldns\_key*. And **perldoc Net::DNS**, **RFC1034**, **RFC1035**, **RFC4033**, **RFC4034**  and **RFC4035**.

## REMARKS

This manpage was automatically generated from the ldns source code.
