home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.programming      Programming issues that transcend langua      57,431 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 55,653 of 57,431   
   Paul N to Malcolm McLean   
   Re: Partial shuffle   
   28 Mar 22 14:12:17   
   
   From: gw7rib@aol.com   
      
   On Saturday, March 26, 2022 at 10:28:43 PM UTC, Malcolm McLean wrote:   
   > You have a list of candidates, ranked by score. You want to try them out in   
   order, with the better candidates being tried first. However you don't want   
   the process to be deterministic - each run should yield a separate order. And   
   you want even low-   
   ranked candidates to have some chance of being tried early.    
   >    
   > Is there a partial sort / partial shuffle which can achieve this?    
   >    
   > (The application is a crossword grid filler. I score the words, then try to   
   fit them into the grid. But I want a different grid each time, and I don't   
   want it to be too obvious that words with uncommon letters are never chosen.)   
      
   You could add the scores, pick a number from 1 to that total, and pick as your   
   first candidate the one at that position. Repeat the process for the remaining   
   candidates to pick your second candidate, etc. You could add some sort of   
   scaling to the scores    
   to bias it more in favour of the high-scoring candidates, eg raise all the   
   scores to a power.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca