1MONGOC_RAND(3) libmongoc MONGOC_RAND(3)
2
3
4
6 mongoc_rand - mongoc_rand
7
8 MongoDB Random Number Generator
9
11 void
12 mongoc_rand_add (const void *buf, int num, double entropy);
13
14 void
15 mongoc_rand_seed (const void *buf, int num);
16
17 int
18 mongoc_rand_status (void);
19
21 The mongoc_rand family of functions provide access to the low level
22 randomness primitives used by the MongoDB C Driver. In particular,
23 they control the creation of cryptographically strong pseudo-random
24 bytes required by some security mechanisms.
25
26 While we can usually pull enough entropy from the environment, you may
27 be required to seed the PRNG manually depending on your OS, hardware
28 and other entropy consumers running on the same system.
29
31 mongoc_rand_add and mongoc_rand_seed allow the user to directly provide
32 entropy. They differ insofar as mongoc_rand_seed requires that each
33 bit provided is fully random. mongoc_rand_add allows the user to spec‐
34 ify the degree of randomness in the provided bytes as well.
35
37 The mongoc_rand_status function allows the user to check the status of
38 the mongoc PRNG. This can be used to guarantee sufficient entropy at
39 program startup, rather than waiting for runtime errors to occur.
40
42 MongoDB, Inc
43
45 2017-present, MongoDB, Inc
46
47
48
49
501.20.0 Nov 18, 2021 MONGOC_RAND(3)