• Russ Cox's avatar
    runtime: make select fairer · 4f269d30
    Russ Cox authored
    The o+i*p approach to visiting select cases in random
    order stops being fair when there is some case that
    is never ready.  If that happens, then the case that follows
    it in the order gets more chances than the others.
    
    In general the only way to ensure fairness is to make
    all permutations equally likely.  I've done that by computing
    one explicitly.
    
    Makes the permutations correct for n >= 4 where
    previously they were broken.  For n > 12, there's not
    enough randomness to do a perfect job but this should
    still be much better than before.
    
    Fixes #1425.
    
    R=r, ken2, ejsherry
    CC=golang-dev
    https://golang.org/cl/4037043
    4f269d30
Name
Last commit
Last update
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...