Document the BN library.
[openssl.git] / doc / crypto / BN_rand.pod
1 =pod
2
3 =head1 NAME
4
5 BN_rand - Generate pseudo-random number
6
7 =head1 SYNOPSIS
8
9  #include <openssl/bn.h>
10
11  int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
12
13 =head1 DESCRIPTION
14
15 BN_rand() generates a cryptographically strong pseudo-random number of
16 B<bits> bits in length and stores it in B<rnd>. If B<top> is true, the
17 two most significant bits of the number will be set to 1, so that the
18 product of two such random numbers will always have 2*B<bits> length.
19 If B<bottom> is true, the number will be odd.
20
21 The PRNG must be seeded prior to calling BN_rand().
22
23 =head1 RETURN VALUES
24
25 BN_rand() returns 1 on success, 0 on error.
26 The error codes can be obtained by ERR_get_error(3).
27
28 =head1 SEE ALSO
29
30 bn(3), err(3), rand(3), RAND_add(), RAND_bytes()
31
32 =head1 HISTORY
33
34 BN_rand() is available in all versions of SSLeay and OpenSSL.
35
36 =cut