This works for me (Although there may be a better way)...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="onCreationComplete()">
     <mx:Script>
         <![CDATA[
             private var randomNumberArray:Array = new Array();
             private var minMaxArray:Array = new Array();
             private var currentMinMaxObject:Object;

             private function onCreationComplete():void
             {
                 for(var i:int = 0 ; i < 100 ; i++)
                 {
                     randomNumberArray.push(int(Math.random() * 100));
                 }
                 for(i = 0 ; i < 74 ; i++)
                 {
                     for(var j:int = 0 ; j < 26 ; j++)
                     {
                         currentMinMaxObject = new Object();
                         currentMinMaxObject.min = randomNumberArray[j +
i];
                         currentMinMaxObject.max = randomNumberArray[j +
i];
                         if(randomNumberArray[j + i + 1] >
currentMinMaxObject.max)
                         {
                             currentMinMaxObject.max =
randomNumberArray[j + i + 1];
                         }
                         if(randomNumberArray[j + i + 1] <
currentMinMaxObject.min)
                         {
                             currentMinMaxObject.min =
randomNumberArray[j + i + 1];
                         }
                     }
                     minMaxArray.push(currentMinMaxObject);
                 }
             }
         ]]>
     </mx:Script>
</mx:Application>
--- In flexcoders@yahoogroups.com, Sherif Abdou <sherif...@...> wrote:
>
> I have an array collection and I am trying to find the Min/Max of the
values in groups. For Example my array collection has 100 values. I want
to find the Min Value/Max Value between 1 to 26, 2 to 27, 3 to 28 ,
etc.... I tried to create 2 for loops in each other but for some reason
during debugging/tracing it outputs wrong numbers, but if i do
breakpoint then step in. I get the correct values. So the question is is
there a better way than what i am doing. I am just trying to create a
Stochastic formula.
>

Reply via email to