static int drbg_add(const void *buf, int num, double randomness)
{
    int ret = 0;
    RAND_DRBG *drbg = RAND_DRBG_get0_master();
    size_t buflen;
    size_t seedlen = rand_drbg_seedlen(drbg);
    if (drbg == NULL)
        return 0;
    if (num < 0 || randomness < 0.0)
        return 0;
    buflen = (size_t)num;
    if (buflen < seedlen || randomness < (double) seedlen) {
#if defined(OPENSSL_RAND_SEED_NONE)
        unsigned char dummy[1];
        return RAND_DRBG_generate(drbg, dummy, sizeof(dummy), 0, buf, buflen);
#else
        randomness = 0.0;
#endif
    }
    if (randomness > (double)seedlen) {
        randomness = (double)seedlen;
    }
    rand_drbg_lock(drbg);
    ret = rand_drbg_restart(drbg, buf, buflen, (size_t)(8 * randomness));
    rand_drbg_unlock(drbg);
    return ret;
}
['static int drbg_add(const void *buf, int num, double randomness)\n{\n    int ret = 0;\n    RAND_DRBG *drbg = RAND_DRBG_get0_master();\n    size_t buflen;\n    size_t seedlen = rand_drbg_seedlen(drbg);\n    if (drbg == NULL)\n        return 0;\n    if (num < 0 || randomness < 0.0)\n        return 0;\n    buflen = (size_t)num;\n    if (buflen < seedlen || randomness < (double) seedlen) {\n#if defined(OPENSSL_RAND_SEED_NONE)\n        unsigned char dummy[1];\n        return RAND_DRBG_generate(drbg, dummy, sizeof(dummy), 0, buf, buflen);\n#else\n        randomness = 0.0;\n#endif\n    }\n    if (randomness > (double)seedlen) {\n        randomness = (double)seedlen;\n    }\n    rand_drbg_lock(drbg);\n    ret = rand_drbg_restart(drbg, buf, buflen, (size_t)(8 * randomness));\n    rand_drbg_unlock(drbg);\n    return ret;\n}', 'RAND_DRBG *RAND_DRBG_get0_master(void)\n{\n    if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init))\n        return NULL;\n    return master_drbg;\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}', 'static size_t rand_drbg_seedlen(RAND_DRBG *drbg)\n{\n    size_t min_entropy = drbg->strength;\n    size_t min_entropylen = drbg->min_entropylen;\n    if (drbg->min_noncelen > 0 && drbg->get_nonce == NULL) {\n        min_entropy += drbg->strength / 2;\n        min_entropylen += drbg->min_noncelen;\n    }\n    min_entropy >>= 3;\n    return min_entropy > min_entropylen ? min_entropy : min_entropylen;\n}']