project_files/HedgewarsMobile/Classes/HWUtils.m
branchios-revival
changeset 11206 2e80c9861818
parent 11148 064a53861759
child 11219 c51ecb9bcf05
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m	Wed Oct 14 02:28:32 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m	Wed Oct 14 21:25:49 2015 +0200
@@ -103,14 +103,13 @@
 +(NSInteger) randomPort {
     // set a new feed only at initialization time and forbid connecting to the server port
     if (activePorts == nil) {
-        srandom(time(NULL));
         activePorts = [[NSMutableArray arrayWithObject:[NSNumber numberWithInt:NETGAME_DEFAULT_PORT]] retain];
     }
 
     // pick a random number from the free ports list
     NSInteger res = 0;
     do {
-        res = (random() % 64511) + 1024;
+        res = (arc4random_uniform(64511)) + 1024;
     } while ([activePorts containsObject:[NSNumber numberWithInteger:res]]);
 
     // add this number to the forbdding list