1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Remove the call to srand() and add better comments to the sqliteOsRandomSeed()

routine.  Ticket #163. (CVS 759)

FossilOrigin-Name: d87a886d8f63f54466848151e2b0e8565b338593
This commit is contained in:
drh
2002-10-12 13:43:59 +00:00
parent c8f8b632c3
commit f1f0fa0769
3 changed files with 10 additions and 15 deletions

View File

@ -788,10 +788,11 @@ int sqliteOsUnlock(OsFile *id){
}
/*
** Get information to seed the random number generator.
** Get information to seed the random number generator. The seed
** is written into the buffer zBuf[256]. The calling function must
** supply a sufficiently large buffer.
*/
int sqliteOsRandomSeed(char *zBuf){
static int once = 1;
#ifdef SQLITE_TEST
/* When testing, always use the same random number sequence.
** This makes the tests repeatable.
@ -807,12 +808,6 @@ int sqliteOsRandomSeed(char *zBuf){
#if OS_WIN && !defined(SQLITE_TEST)
GetSystemTime((LPSYSTEMTIME)zBuf);
#endif
if( once ){
int seed;
memcpy(&seed, zBuf, sizeof(seed));
srand(seed);
once = 0;
}
return SQLITE_OK;
}