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 via
26 .I truerand
27 (see
28 .MR rand (3) ).
29 .PP
30 .I Prng
31 uses the native
32 .MR rand (3)
33 pseudo-random number generator to fill the buffer. Used with
34 .IR srand ,
35 this function can produce a reproducible stream of pseudo random
36 numbers useful in testing.
37 .PP
38 Both functions may be passed to
39 .I mprand
40 (see
41 .MR mp (3) ).
42 .SH SOURCE
43 .B \*9/src/libsec
44 .SH SEE ALSO
45 .MR mp (3)