
Код AS3:
private function randomTake():void
{
var list:XMLList =
<>
<foo attribute="0"/>
<foo attribute="1"/>
<foo attribute="2"/>
<foo attribute="3"/>
<foo attribute="4"/>
<foo attribute="5"/>
<foo attribute="6"/>
<foo attribute="7"/>
<foo attribute="8"/>
<foo attribute="9"/>
</>;
var result:XMLList = list.copy();
while (result.length() > 5)
{
delete result[Math.random() * result.length() >> 0];
}
trace(result);
}