Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mp(2)

GENRANDOM(2)

NAME

genrandom, prng − random number generation

SYNOPSIS

­#include <u.h>
­#include <libc.h>
­#include <mp.h>
­#include <libsec.h>

voidgenrandom(uchar ∗buf, int nbytes)

voidprng(uchar ∗buf, int nbytes)

DESCRIPTION

Most security software requires a source of random or, at the very least, unguessable numbers. 

­Genrandom fills a buffer with bytes from the X9.17 pseudo-random number generator.  The X9.17 generator is seeded by 24 truly random bytes read from /dev/random. 

­Prng uses the native rand(2) pseudo-random number generator to fill the buffer.  Used with srand, this function can produce a reproducible stream of pseudo random numbers useful in testing.

Both functions may be passed to ­mprand (see mp(2)).

SOURCE

­/sys/src/libsec

SEE ALSO

mp(2)

Plan 9  —  March 27, 2002

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026