A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Final Fantasy

Threaded View

  1. #10
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    they do the same thing, but no, they are not the same. try this:
    code:
    tests=100;
    iterations=1000;//per test, defines accuracy
    for(t=1 ; t<=tests ; t++){
    t1=getTimer();
    for(i=1 ; i<=iterations ; i++){
    random(n);
    }
    trace((getTimer()-t1)/iterations);

    t2=getTimer();
    for(i=1 ; i<=iterations ; i++){
    Math.random()*n;
    }
    trace((getTimer()-t2)/iterations);
    trace("");
    }



    doing it by Math.random is consistently slower(tho they are both cons. less than .05 millisecond on my PC), as to be expected. anything hard coded in Flash *should* be faster.

    [EDIT] if you take out the *n for the Math.random() you find that Math.random() is *still* about .01 - .05 of a millisecond slower... so i guess always use random()? of course, we are talking about debatably completely inconsequential difference in speed here... .01 of a millisecond????
    Last edited by >flashl!ght<; 09-24-2004 at 06:46 PM.
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center