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