Собственно, решил сделать эксперимент интереса ради

Код AS3:
package tests
{
import flash.display.Sprite;
/**
* ...
* @author wvxvw
*/
public class ProbablityTester extends Sprite
{
private const _variants:Vector.<uint> =
new <uint>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
private const _weights:Vector.<uint> =
new <uint>[1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
public function ProbablityTester()
{
super();
// position: 0 total: 99435
// position: 1 total: 100361
// position: 2 total: 99991
// position: 3 total: 99921
// position: 4 total: 99452
// position: 5 total: 100059
// position: 6 total: 100715
// position: 7 total: 100259
// position: 8 total: 99848
// position: 9 total: 99959
this.testDistribution();
// exclude 5 from the pool completely
this.setChance(5, 0);
// position: 0 total: 111148
// position: 1 total: 111645
// position: 2 total: 111153
// position: 3 total: 111161
// position: 4 total: 111147
// position: 5 total: 0
// position: 6 total: 111019
// position: 7 total: 110609
// position: 8 total: 110869
// position: 9 total: 111249
this.testDistribution();
// double the chances for 6
this.setChance(6, 2);
// position: 0 total: 100195
// position: 1 total: 99949
// position: 2 total: 99909
// position: 3 total: 99673
// position: 4 total: 100513
// position: 5 total: 0
// position: 6 total: 200260
// position: 7 total: 99795
// position: 8 total: 99600
// position: 9 total: 100106
this.testDistribution();
}
public function setChance(of:uint, to:uint):void
{
of = of % 10;
this._weights[of] = to;
}
private function testDistribution():void
{
var results:Vector.<uint> = new Vector.<uint>(10);
var i:int;
for (i = 0; i < 1e6; i++)
{
results[this.selectRandom()]++;
}
for (i = 0; i < 10; i++)
{
trace("position:", i, "total:", results[i]);
}
}
private function selectRandom():uint
{
var result:uint;
var weight:uint;
var random:uint = this.sum() * Math.random();
for (var i:int; i < 10; i++)
{
weight = this._weights[i];
if (random < weight)
{
result = i;
break;
}
else random -= weight;
}
return result;
}
private function sum():uint
{
var result:uint;
for each (var i:uint in this._weights) result += i;
return result;
}
}
}
EDIT: перемудрил в первый раз