aboutsummaryrefslogtreecommitdiffstats
path: root/code/unix/unix_shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/unix/unix_shared.c')
-rw-r--r--code/unix/unix_shared.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/code/unix/unix_shared.c b/code/unix/unix_shared.c
index c037813..a607a2f 100644
--- a/code/unix/unix_shared.c
+++ b/code/unix/unix_shared.c
@@ -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