mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
call srand with current time (attempting to fix what may be duplicate
seeds on relay, possible if rand() always starts with same sequence on different devices in new process); add commented-out logging util_rand implementation.
This commit is contained in:
parent
6be5105eff
commit
51d759569a
2 changed files with 14 additions and 0 deletions
|
@ -444,3 +444,13 @@ and_empty_stream( MPFORMAL AndGlobals* globals )
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #ifdef DEBUG */
|
||||||
|
/* XP_U32 */
|
||||||
|
/* andy_rand( const char* caller ) */
|
||||||
|
/* { */
|
||||||
|
/* XP_U32 result = rand(); */
|
||||||
|
/* XP_LOGF( "%s: returning 0x%lx to %s", __func__, result, caller ); */
|
||||||
|
/* LOG_RETURNF( "%lx", result ); */
|
||||||
|
/* return result; */
|
||||||
|
/* } */
|
||||||
|
/* #endif */
|
||||||
|
|
|
@ -337,6 +337,10 @@ Java_org_eehouse_android_xw4_jni_XwJNI_initJNI
|
||||||
MPASSIGN( state->mpool, mpool );
|
MPASSIGN( state->mpool, mpool );
|
||||||
globals->vtMgr = make_vtablemgr(MPPARM_NOCOMMA(mpool));
|
globals->vtMgr = make_vtablemgr(MPPARM_NOCOMMA(mpool));
|
||||||
|
|
||||||
|
XP_U32 secs = and_util_getCurSeconds( NULL );
|
||||||
|
XP_LOGF( "initing srand with %ld", secs );
|
||||||
|
srandom( secs );
|
||||||
|
|
||||||
return (jint) state;
|
return (jint) state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue