summaryrefslogtreecommitdiff
path: root/core/network.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-06-27 17:19:09 -0400
committerirungentoo <irungentoo@gmail.com>2013-06-27 17:19:09 -0400
commit3986206de89f7094ba1300e72a7a46916bae7ff4 (patch)
tree5b97a5d2d3c325d3b7e9259b0587c08431e2b731 /core/network.c
parent87633f663134127b84fbc61828bfba491e149f6a (diff)
Added a function.
Diffstat (limited to 'core/network.c')
-rw-r--r--core/network.c14
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
43int 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.
44static int sock; 54static 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);