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:
11
src/os.c
11
src/os.c
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user