Changeset View
Changeset View
Standalone View
Standalone View
dealer.cpp
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
| 61 | 61 | | |||
| 62 | #include <cmath> | 62 | #include <cmath> | ||
| 63 | 63 | | |||
| 64 | 64 | | |||
| 65 | namespace | 65 | namespace | ||
| 66 | { | 66 | { | ||
| 67 | const qreal wonBoxToSceneSizeRatio = 0.7; | 67 | const qreal wonBoxToSceneSizeRatio = 0.7; | ||
| 68 | 68 | | |||
| 69 | QList<KCard*> shuffled( const QList<KCard*> & cards, int seed ) | 69 | QList<KCard*> shuffled( const QList<KCard*> & cards, unsigned int seed ) | ||
| 70 | { | 70 | { | ||
| 71 | Q_ASSERT( seed > 0 ); | | |||
| 72 | | ||||
| 73 | QList<KCard*> result = cards; | 71 | QList<KCard*> result = cards; | ||
| 74 | for ( int i = result.size(); i > 1; --i ) | 72 | for ( int i = result.size(); i > 1; --i ) | ||
| 75 | { | 73 | { | ||
| 76 | // We use the same pseudorandom number generation algorithm as Windows | 74 | // We use the same pseudorandom number generation algorithm as Windows | ||
| 77 | // Freecell, so that game numbers are the same between the two applications. | 75 | // Freecell, so that game numbers are the same between the two applications. | ||
| 78 | // For more inforation, see | 76 | // For more inforation, see | ||
| 79 | // http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q28150 | 77 | // http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q28150 | ||
| 80 | seed = 214013 * seed + 2531011; | 78 | seed = 214013 * seed + 2531011; | ||
| ▲ Show 20 Lines • Show All 2040 Lines • Show Last 20 Lines | |||||