5 BN_rand - Generate pseudo-random number
9 #include <openssl/bn.h>
11 int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
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.
21 The PRNG must be seeded prior to calling BN_rand().
25 BN_rand() returns 1 on success, 0 on error.
26 The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
30 L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
31 L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)>
35 BN_rand() is available in all versions of SSLeay and OpenSSL.