From 3986206de89f7094ba1300e72a7a46916bae7ff4 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 27 Jun 2013 17:19:09 -0400 Subject: Added a function. --- core/network.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/network.c') 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() } +int random_int() +{ + #ifdef WIN32 + //TODO replace rand with a more random windows function + return rand(); + #else + return random(); + #endif +} + //our UDP socket, a global variable. static int sock; @@ -87,7 +97,11 @@ int init_networking(IP ip ,uint16_t port) { return -1; } + + #else + srandom((uint32_t)current_time()); #endif + srand((uint32_t)current_time()); //initialize our socket sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -- cgit v1.2.3