[xiph-commits] r17678 - trunk/squishyball
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Mon Nov 29 06:34:48 PST 2010
Author: xiphmont
Date: 2010-11-29 06:34:48 -0800 (Mon, 29 Nov 2010)
New Revision: 17678
Modified:
trunk/squishyball/main.c
Log:
Fix the XXY randomization
Modified: trunk/squishyball/main.c
===================================================================
--- trunk/squishyball/main.c 2010-11-29 02:22:39 UTC (rev 17677)
+++ trunk/squishyball/main.c 2010-11-29 14:34:48 UTC (rev 17678)
@@ -191,14 +191,16 @@
*cchoice = 1;
break;
case 2:
- r[0] = random()&1;
- r[1] = random()&1;
- if(r[0] == r[1])
- r[2]=1-r[0];
- else
- r[2] = random()&1;
+ r[0] = r[1] = r[2] = 0;
+ r[random()%3] = 1;
+ if (random()&1)
+ {
+ r[0] = 1-r[0];
+ r[1] = 1-r[1];
+ r[2] = 1-r[2];
+ }
+ *cchoice = (r[0]==r[1] ? 2 : (r[1]==r[2] ? 0 : 1));
break;
- *cchoice = (r[0]==r[1] ? 2 : (r[1]==r[2] ? 0 : 1));
}
}
More information about the commits
mailing list