User Tag List

Results 1 to 3 of 3

Thread: Getting a random number between a negative and positive number

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2012
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Getting a random number between a negative and positive number

    I know in order to get a random number between 0 and whatever number you do:

    Set Value to Random(#)

    But how would I get a random number between a negative number and a positive number?

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    random(final-start+1)+start

    To get a random number beween 0 and 299, you'd use
    random(299-0+1)-0 which simplifies to random(300), much like you were doing before

    For negatives it's the same formula, to go between -45 and 211 you would do
    random(211-(-45)+1)-45 which simplifies to random(257)-45

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2012
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man!

Similar Threads

  1. Random ranging from floating negative to positive?
    By oldkliker in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 21st September 2011, 01:08 AM
  2. Random number
    By Mayfly in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 27th August 2008, 11:36 AM
  3. Binary Object: Byte returning negative number
    By aidmm in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 19th April 2008, 10:46 AM
  4. Converting part of a string to negative number
    By Simion32 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th April 2007, 12:44 AM
  5. Random Number Gen
    By mee in forum The Games Factory 2 - Technical Support
    Replies: 3
    Last Post: 7th February 2007, 09:06 PM

Posting Permissions

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