diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index f7c899ceb..3d77f244a 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -128,6 +128,7 @@ scramble(void *data, int n, size_t width) assert(width<=sizeof(temp)); for (j=0;j!=n;++j) { int k = rand() % n; + if (k==j) continue; memcpy(temp, (char*)data+j*width, width); memcpy((char*)data+j*width, (char*)data+k*width, width); memcpy((char*)data+k*width, temp, width);