User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Random Equation With Specifics

  1. #1
    No Products Registered

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

    Random Equation With Specifics

    My mind is mush today thinking about all of the new MMF2 features. I've been toying around with equations all morning trying to find one that can only yield the answers 4,6,8,9. Can anyone tell me an equation using the Random() function that will only produce one of those numbers?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Random Equation With Specifics

    val(Mid$("4689", Random(4), 1))

    If you need me to explain why it works I can.
    .:::.Joshtek.:::.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Equation With Specifics

    That's an amusingly ingenious solution.


  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Random Equation With Specifics

    Quote Originally Posted by Dynasoft
    That's an amusingly ingenious solution.

    Thank you.
    .:::.Joshtek.:::.

  5. #5
    Clicker Fusion 2.5

    Join Date
    Jun 2006
    Location
    Stockholm, Sweden
    Posts
    1,529
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Equation With Specifics

    I wish i could understand that equation... hehe ^_^

  6. #6
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Equation With Specifics

    Very clever indeed !
    @cocodrillo : what he's doing isn't maths, he's just picking one character in the "4689" string, using Mid(str,firstchar,length).

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2006
    Location
    Hampshire, UK
    Posts
    963
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Equation With Specifics

    Ahaha, i've come across this problem once or twice before and yes, that is an amazing solution! Wish i'd thought of that before!

  8. #8
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Random Equation With Specifics

    Corentin is correct.

    [font:Courier New]val(string)[/font]: Converts a string to a number.
    [font:Courier New]Mid$(string,start position,length)[/font]: "Extracts a sub string starting at a given position. Example, MID$("Hello", 2, 3) will return "ell"."
    [font:Courier New]Random(maximum value)[/font]: "Retrieves a random number. The parameter you specify determines the maximum value of the random number."

    --------

    [font:Courier New]val(Mid$("4689", Random(4), 1))[/font]
    Generates a random number between 0 and 3.

    [font:Courier New]val(Mid$("4689", Random(4), 1))[/font]
    Uses the generated number to decide starting position and therefore which character to extract from the sub string (only 1 character is returned because length is 1). If the random number was 0 then it'd be the same as Mid$("4689",0,1) which gets the first character. Using this method every randomly generated number is effectively mapped to a character in the string.

    [font:Courier New]val(Mid$("4689", Random(4), 1))[/font]
    Converts the randomly chosen character from a string to a number.
    .:::.Joshtek.:::.

  9. #9
    No Products Registered

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

    Re: Random Equation With Specifics

    That is quite amazingly simple. Turning them into a string and back into a number. I had been trying all sorts of things like (Random(2)+2)*(Random(3)+1) and all sorts of weird things. I had done something like that in the past for an encoder. I used the ASCII function of the string parser to turn each letter of a phrase into a number, add a couple values to it, and turn it back into letters again. Your method could come in handy for a lot of other things too.

  10. #10
    No Products Registered

    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    1,654
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Equation With Specifics

    Quote Originally Posted by Cocodrilo
    I wish i could understand that equation... hehe ^_^
    ye same....

Page 1 of 2 1 2 LastLast

Similar Threads

  1. [new ext] Quadratic Equation
    By bufferOverflow in forum Extension Development
    Replies: 10
    Last Post: 22nd June 2011, 09:47 PM
  2. Random Equation Generator for Algebra problems?
    By Matt Koller in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 2nd March 2009, 09:41 PM
  3. Even spread equation
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 26th September 2007, 12:53 AM
  4. ODBC object specifics
    By LeGauche in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st August 2006, 06:56 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
  •