User Tag List

Results 1 to 9 of 9

Thread: RANDOM problem

  1. #1
    No Products Registered

    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RANDOM problem

    Hi everybody,
    I just got TGF2 and try to do some experiment with it.
    There is a Counter object added to the sence and I make the Counter to do random of a ranged values from 1 to 9 when pressing the Spacebar.
    I give the expression "Random(1-9)" to the Counter, but the resulting value is out of the range. What's wrong with the condition? Did the expression I set was wrong?
    Please help

  2. #2
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    Use Random(9)+1

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    Yes, the Random function gives you a random number from 0 to (the number you give it - 1). What you tried first would have been interpreted as random(-8).

  4. #4
    No Products Registered

    Join Date
    Aug 2008
    Location
    Faroe Islands
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    some examples, using dies:

    to get 1D6, you need to code it; RANDOM(5)+1
    to get 2D6, you need to code it; RANDOM(10)+2
    to get % die, you need to code it; RANDOM(99)+1

    so to get a random number between 1 and 9, you need to code it; RANDOM(8)+1

    hopes this gives a little inside...

  5. #5
    Clicker Multimedia Fusion 2
    dragonguy's Avatar
    Join Date
    Apr 2008
    Location
    RULE BRITANNIA!
    Posts
    3,071
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    In Random(N) where N is exactly how many different numbers it can generate, therefore it is from 0 to N-1, I have tested it and it really works this way.

    The only person here before me who got it correct was Brandon.
    Don't feel bad it's common mistake what you two made.

  6. #6
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    Quote Originally Posted by dragonguy
    Don't feel bad it's common mistake what you two made.
    Nothing DavidN said was wrong.

  7. #7
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    I wouldn't pursue it... experience says that it's simpler that way.

  8. #8
    Clicker Multimedia Fusion 2
    dragonguy's Avatar
    Join Date
    Apr 2008
    Location
    RULE BRITANNIA!
    Posts
    3,071
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    Well sorry to you both Brandon, DavidN, I just misunderstood what you said there, my tests with random(3) are pretty conclusive.
    I just set a counter to random(3) every second and i got these results.

    001120210210212020120121

    Quote Originally Posted by Multimedia Fusion 2 Help File - Special Object - Expressions
    Generate A Random Number
    This function retrieves a random number. The parameter you specify determines the maximum value of the random number. For example, random(5) generates random numbers between 0 and 4 inclusive. You can type Random(x) directly into the Expression Evaluator. You don't have to select the Special object function. Note: the maximum value for the parameter is 65535.

  9. #9
    Clicker Fusion 2.5 Developer
    00J's Avatar
    Join Date
    Jun 2006
    Location
    Virginia, USA
    Posts
    1,510
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: RANDOM problem

    001120210210212020120121

    So what's the problem? [laugh]

    Run it a few more times, and see what you get. I bet it won't be 001120210210212020120121...

    0 = 1
    1 = 2
    2 = 3


Similar Threads

  1. Random displaying problem!
    By Radical in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 25th October 2013, 09:44 PM
  2. Random problem
    By dontknow in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 12th June 2011, 07:18 AM
  3. A random problem
    By Watermelon786 in forum File Archive
    Replies: 3
    Last Post: 2nd January 2011, 08:50 PM
  4. Random number problem
    By Bk90 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 29th December 2009, 12:19 AM
  5. random value + another problem
    By Tolkkiz in forum The Games Factory 2 - Technical Support
    Replies: 5
    Last Post: 13th November 2007, 08:27 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
  •