* (bug 3019) use the operating system's random number generator if possible

when generating the qkey file
This commit is contained in:
Tony J. White = 2007-02-16 23:50:37 +00:00
parent 8801b06a1e
commit c6249fcc25
7 changed files with 65 additions and 9 deletions

View file

@ -174,6 +174,22 @@ char *strlwr (char *s) {
return s; // bk001204 - duh
}
qboolean Sys_RandomBytes( byte *string, int len )
{
FILE *fp;
fp = fopen( "/dev/urandom", "r" );
if( !fp )
return qfalse;
if( !fread( string, sizeof( byte ), len, fp ) ) {
fclose( fp );
return qfalse;
}
fclose( fp );
return qtrue;
}
//============================================
#define MAX_FOUND_FILES 0x1000