Improve random map seed generation
authorkwolekr <mirrorisim@gmail.com>
Wed, 23 Jan 2013 15:13:04 +0000 (10:13 -0500)
committerkwolekr <mirrorisim@gmail.com>
Wed, 6 Feb 2013 06:10:37 +0000 (01:10 -0500)
src/map.cpp

index ea82194b85ccca4211797f6de18d51d08d256674..ab9cb25dd20b97b37cb76db7379c42ecd0f1e408 100644 (file)
@@ -2013,10 +2013,10 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
 
        if (g_settings->get("fixed_map_seed").empty())
        {
-               m_seed = (((u64)(myrand()%0xffff)<<0)
-                               + ((u64)(myrand()%0xffff)<<16)
-                               + ((u64)(myrand()%0xffff)<<32)
-                               + ((u64)(myrand()&0xffff)<<48));
+               m_seed = (((u64)(myrand() & 0xffff) << 0)
+                               | ((u64)(myrand() & 0xffff) << 16)
+                               | ((u64)(myrand() & 0xffff) << 32)
+                               | ((u64)(myrand() & 0xffff) << 48));
                m_mgparams->seed = m_seed;
        }