mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
comment on shuffling
This commit is contained in:
parent
73170b1254
commit
fae618b082
1 changed files with 7 additions and 0 deletions
|
@ -124,6 +124,13 @@ getNthPoolTile( PoolContext* pool, short index )
|
|||
static Tile
|
||||
getRandomTile( PoolContext* pool )
|
||||
{
|
||||
/* There's a good little article on shuffling algorithms here:
|
||||
* http://en.wikipedia.org/wiki/Shuffle#Shuffling_algorithms This puppy
|
||||
* can definitely be improved. PENDING. But note that what's here still
|
||||
* works when tiles are re-inserted in the pool. Will need to reshuffle
|
||||
* in that case if move to shuffling once and just taking tiles off the
|
||||
* top thereafter.
|
||||
*/
|
||||
XP_U16 index = (XP_U16)(XP_RANDOM() % pool->numTilesLeft);
|
||||
Tile result;
|
||||
|
||||
|
|
Loading…
Reference in a new issue