Give the SQLITE_TESTCTRL_PRNG_SEED two arguments. The second argument if not
NULL is a pointer to a database connection which seeds the connection from
its schema cookie. In this way, fuzzers can control the PRNG seed.
Closed-Leaf
check-in: 49aa3448 user: drh tags: prng-seed-test-control

If a query like "SELECT min(a), b FROM t1" visits no rows where "a" is not null, extract a value for "b" from one of the rows where "a" is null. Fix for ticket [41866dc37].
check-in: faaaae49 user: dan tags: trunk

** this verb acts like PRNG_RESET.
*/
case SQLITE_TESTCTRL_PRNG_RESTORE: {
sqlite3PrngRestoreState();
break;
}
/* sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, int x, sqlite3 *db);**
** Control the seed for the pseudo-random number generator (PRNG) that
** is built into SQLite. Cases: ** ** x!=0 && db!=0 Seed the PRNG to the current value of the ** schema cookie in the main database for db, or ** x if the schema cookie is zero. This case ** is convenient to use with database fuzzers ** as it allows the fuzzer some control over the ** the PRNG seed. ** ** x!=0 && db==0 Seed the PRNG to the value of x. ** ** x==0 && db==0 Revert to default behavior of using the ** xRandomness method on the primary VFS. ** ** This test-control also resets the PRNG so that the new seed will ** be used for the next call to sqlite3_randomness().
*/
case SQLITE_TESTCTRL_PRNG_SEED: {
int x = va_arg(ap, int); int y; sqlite3 *db = va_arg(ap, sqlite3*); assert( db==0 || db->aDb[0].pSchema!=0 ); if( db && (y = db->aDb[0].pSchema->schema_cookie)!=0 ){ x = y; } sqlite3Config.iPrngSeed = x;
sqlite3_randomness(0,0);
break;
}
/*
** sqlite3_test_control(BITVEC_TEST, size, program)
**