Skip to content

Commit

Permalink
use rand() instead of get_random() for side shuffle
Browse files Browse the repository at this point in the history
1) i think it's better to use a simple rand function for things that are
never synced, because everyone knows that rand() isn't synced.
2) my plan is to delete the get_random() function.
  • Loading branch information
gfgtdf committed Apr 16, 2014
1 parent b576385 commit 8b89c01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/multiplayer_connect_engine.cpp
Expand Up @@ -24,7 +24,7 @@
#include "tod_manager.hpp"

#include <boost/foreach.hpp>

#include <stdlib.h>
static lg::log_domain log_config("config");
#define LOG_CF LOG_STREAM(info, log_config)
#define WRN_CF LOG_STREAM(warn, log_config)
Expand Down Expand Up @@ -430,7 +430,7 @@ void connect_engine::start_game(LOAD_USERS load_users)
// Fisher-Yates shuffle.
for (int i = playable_sides.size(); i > 1; i--)
{
int j_side = playable_sides[get_random() % i];
int j_side = playable_sides[rand() % i];
int i_side = playable_sides[i - 1];

if (i_side == j_side) continue; //nothing to swap
Expand Down

0 comments on commit 8b89c01

Please sign in to comment.