User Tag List

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 22

Thread: Random number without last number ? (It's possible ?) (random counter)

  1. #11
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Jan 2015
    Posts
    262
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Wow, great and very helpfull solution. Thanks

  2. #12
    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)
    Val(Mid$(Left$("01020304050607080910", (value( "Counter" )-1)*2)+Right$("01020304050607080910", 20-(value( "Counter" )*2)), Random(9)*2, 2))

    Can... someone break down what this fearsome line is doing? It's beyond me at this time in the afternoon

  3. #13
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    It took me a while to get,
    but I really like this kind of things so it was well worth

    let's disregard "val",

    then we have:

    Mid$(*string*, Random(9)*2,2)

    *string* is composed by:

    Left$("01020304050607080910",(value("Counter")-1)*2)

    will return the left part before counter value
    (i.e. counter=6, will return "0102030405")

    + Right$ ("01020304050607080910", 20-(value( "Counter" )*2))

    will return the right part after counter value
    (i.e. counter=6, will return "07080910")

    so we have a full pool of numbers excluding the counter value
    (i.e. counter=6, string=010203040507080910)

    Now the Mid function will return a even pair of strings from Random(9)*2,
    thus giving a random number excluding the counter value.
    Beautiful and clever!

    Maybe also a little tricky to write down, I can guess

  4. #14
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fun, but don't overlook Tendro's solution - it's by far the most dynamic:

    Set Counter to ( ( value( "Counter" ) + Random(9 ) ) mod 10 ) + 1

  5. #15
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Agreed,
    that's the easier/quicker to setup, and a little more clean to inspect.

    But I'd give both a trophy for brainiest solution

  6. #16
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Jan 2015
    Posts
    262
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tendro View Post
    You guys already found a solution, but you could also use the following:
    Set Counter to (( value( "Counter" ) + 1 + Random(a)) mod (a+1))

    Want random numbers between 0 and 9? Just set a=9:
    Set Counter to (( value( "Counter" ) + 1 + Random(9)) mod 10)

    You'll never have the same number behind one another. Don't forget to +1 when displaying this value to get your 1 to 10 range.
    What Can i do if i want use numbers between 1 - 9 ? (without 0 ? )

  7. #17
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    this should work:

    (( value( "Counter" ) + 1 + Random(8 ) ) mod 9 ) + 1

  8. #18
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Jan 2015
    Posts
    262
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    No it's not working very well because i need numbers between 1-9, but when i use +1 then number 9 + 1 = 10.

  9. #19
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Have you tested it?
    It's not just final +1 but also changed the random(n) and mod(n)

  10. #20
    Clickteam Clickteam
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,647
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    There is a windows only extension called Random Number Pool although I've not used it for years. It might do what you wanted too.

Page 2 of 3 FirstFirst 1 2 3 LastLast

Similar Threads

  1. Getting a random number between a negative and positive number
    By D_Light in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th January 2013, 11:51 PM
  2. Spread random number?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 4th August 2012, 05:36 PM
  3. Random number
    By Mayfly in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 27th August 2008, 12:36 PM
  4. Random Number Experiment
    By Pkeod in forum File Archive
    Replies: 2
    Last Post: 24th December 2007, 12:10 AM
  5. Random Number Gen
    By mee in forum The Games Factory 2 - Technical Support
    Replies: 3
    Last Post: 7th February 2007, 10: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
  •