Blob


1 .TH GENRANDOM 3
2 .SH NAME
3 genrandom, prng \- random number generation
4 .SH SYNOPSIS
5 .B #include <u.h>
6 .br
7 .B #include <libc.h>
8 .br
9 .B #include <mp.h>
10 .br
11 .B #include <libsec.h>
12 .PP
13 .B
14 void genrandom(uchar *buf, int nbytes)
15 .PP
16 .B
17 void prng(uchar *buf, int nbytes)
18 .SH DESCRIPTION
19 Most security software requires a source of random or, at the
20 very least, unguessable numbers.
21 .PP
22 .I Genrandom
23 fills a buffer with bytes from the X9.17 pseudo-random
24 number generator. The X9.17 generator is seeded by 24
25 truly random bytes read from
26 .BR /dev/random .
27 .PP
28 .I Prng
29 uses the native
30 .IR rand (3)
31 pseudo-random number generator to fill the buffer. Used with
32 .IR srand ,
33 this function can produce a reproducible stream of pseudo random
34 numbers useful in testing.
35 .PP
36 Both functions may be passed to
37 .I mprand
38 (see
39 .IR mp (3)).
40 .SH SOURCE
41 .B \*9/src/libsec
42 .SH SEE ALSO
43 .IR mp (3)