A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: randomillicshush...

  1. #1
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    Hey, what is the easiest way to create a random number between -200 and - 100 or 500 and 600?

    I will be using it to randomly attach MovieClips either just to the left of the stage or just to the right.

    Thanks,

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    your name has so long decieved us so...
    random(101)+500; // 500 to 600 inclusive
    random(99)+501; // 500 to 600 exclusive (ie: 501-599)

    random(101)-200; // -200 to -100 inclusive
    random(99)-199; // ... exclusive

    (non-depricated
    Math.floor(Math.random()*101)+500;
    Math.floor(Math.random()*99)+501;

    Math.floor(Math.random()*101)-200;
    Math.floor(Math.random()*99)-199;

    .............................................

    I dont want to post any more because then I wont be
    <----------
    1337!!!

    The only 1337 (h4x0r) overweight in Flashkit. I rule.


    [Edited by senocular on 09-01-2002 at 05:45 PM]

  3. #3
    incredibulus-actionscriptum magnetos's Avatar
    Join Date
    May 2001
    Posts
    2,160
    prrrrrrrr senocular...
    i am fatter than you

  4. #4
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    Cheers senocular, i couldn't quite get my head around that one

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