Hello list,

I have an XMLList that can vary in length. I pick a random node each time using the simple method below:

var tRandom:int = int(Math.random()*tXMLSource.nodes.length() );
return tXMLSource.nodes[tRandom]

Now i would like to change it, so that I can specify a weight to each node. This weight would have to determine the probability the nodes get selected out when a random pick is being performed.

Does anybody know how to build such an algorithm?

Much appreciated,

Flashcoders mailing list

Reply via email to