[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegames/megami
From: Neil Stevens <neil () qualityassistant ! com>
Date: 2003-06-18 16:46:47
[Download RAW message or body]
CVS commit by neil:
In theory an n! shuffle should be most sporting.
M +2 -2 deck.cpp 1.3
--- kdegames/megami/deck.cpp #1.2:1.3
@@ -57,6 +57,6 @@ Deck::Stack Deck::shuffle(bool joker, in
for(int i = 0; i < total * 2; i++)
{
- const int x = std::rand() % total;
- const int y = std::rand() % total;
+ const int x = i % total;
+ const int y = x + (std::rand() % (total - x));
const int swap = a[x];
a[x] = a[y];
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic