diff options
Diffstat (limited to 'core/network.c')
-rw-r--r-- | core/network.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/network.c b/core/network.c index 81da3f1b..a20b02f6 100644 --- a/core/network.c +++ b/core/network.c | |||
@@ -40,6 +40,16 @@ uint64_t current_time() | |||
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | int random_int() | ||
44 | { | ||
45 | #ifdef WIN32 | ||
46 | //TODO replace rand with a more random windows function | ||
47 | return rand(); | ||
48 | #else | ||
49 | return random(); | ||
50 | #endif | ||
51 | } | ||
52 | |||
43 | //our UDP socket, a global variable. | 53 | //our UDP socket, a global variable. |
44 | static int sock; | 54 | static int sock; |
45 | 55 | ||
@@ -87,7 +97,11 @@ int init_networking(IP ip ,uint16_t port) | |||
87 | { | 97 | { |
88 | return -1; | 98 | return -1; |
89 | } | 99 | } |
100 | |||
101 | #else | ||
102 | srandom((uint32_t)current_time()); | ||
90 | #endif | 103 | #endif |
104 | srand((uint32_t)current_time()); | ||
91 | 105 | ||
92 | //initialize our socket | 106 | //initialize our socket |
93 | sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | 107 | sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |