nanoid(3) Library Functions Manual nanoid(3)

nanoidgenerate a Nano ID

#include <nanoid.h>

int
nanoidgen(char *buffer, size_t length);

NANOIDLEN expands to the default Nano ID length of 21.

() fills the buffer with a Nano ID of the specified length up to GETENTROPY_MAX (256) and returns the return value of getentropy(3).

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

nanoidgen(1)

Luka Teras <luka@sdf.org>

January 1, 2025