Diff

net/dns.lua @ 6645:4f934cf03bc9

net.dns: Make sure argument to math.randomseed does not overflow a 32 bit *signed* int (blame Lua). Closes #439
author Kim Alvefur <zash@zash.se>
date Sun, 26 Apr 2015 19:50:24 +0200
parent 6631:45222bfb206f
child 6646:9795b8cf14f1
child 6863:88d54bec26b7
line wrap: on
line diff
--- a/net/dns.lua	Fri Apr 03 12:10:30 2015 +0200
+++ b/net/dns.lua	Sun Apr 26 19:50:24 2015 +0200
@@ -225,7 +225,7 @@
 
 
 function dns.random(...)    -- - - - - - - - - - - - - - - - - - -  dns.random
-	math.randomseed(math.floor(10000*socket.gettime()) % 0x100000000);
+	math.randomseed(math.floor(10000*socket.gettime()) % 0x80000000);
 	dns.random = math.random;
 	return dns.random(...);
 end