Skip to content

Instantly share code, notes, and snippets.

@DmitriyKirakosyan
Created October 7, 2011 05:36
Show Gist options
  • Save DmitriyKirakosyan/1269544 to your computer and use it in GitHub Desktop.
Save DmitriyKirakosyan/1269544 to your computer and use it in GitHub Desktop.
simple random for misha
private function random2():void {
var randoms:Vector.<int> = new Vector.<int>();
var sumRandoms:int = 0;
var tempRnd:int;
var canEnd:Boolean = true;
for (var i:int = 0; i < 5; i++) {
randoms.forEach(function(item:int, ..._):void { sumRandoms += item; }
randoms.push(Math.random() * ((100-sumRandoms) / (5-i)) + sumRandoms);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment