User Tag List

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

Thread: random giving same result EVERY time

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    cfullerNY's Avatar
    Join Date
    Oct 2011
    Posts
    356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random giving same result EVERY time

    I have a frame with some objects in it which are called over and over again
    Each time the frame is loaded, random(18)+1 is called
    Every single time I get the same number!
    I've tried the randomize() function beforehand, which does nothing
    The objects which hold the random number are initialized first to 0 every time and then given the random number
    I have no idea why this is happening but maybe someone can shed light? I've been using random() in MMF for years now and never experienced this
    also, none of the objects are global.

  2. #2
    Clicker Fusion 2.5
    Warmachine's Avatar
    Join Date
    Nov 2009
    Location
    Charleston, WV
    Posts
    653
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When you say called, are you meaning something specific is created? Like enemies? I recently learned about using the random function (under the special conditions) and its been a Godsend! What i do to make mine change up goes like this, YMMV:

    - 2 to 3 times at random
    + Every "00:20" seconds
    => Create enemy at (x and y of your choice)

    This works great for me, and really does take away from trying to create a strategy when fighting against particular pattern based enemies, making the game that much tougher I hope this was helpful dude! Also, if you know this then tell me to STFU lol, but this also works great for attacks/ attack sound effects as well so if you have the character grunt or whatever sound you may have its not always the same every single time or if you have a game that uses combos.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    cfullerNY's Avatar
    Join Date
    Oct 2011
    Posts
    356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    random.jpg

    I have no idea what you're saying but I don't think it's in any way related to my issue. My issue is simple. I randomize a variable several times during a game. Each and every time, the randomized variable gives the same result. That is unexpected. I believe a solution is to store the variable in a counter instead of an alterable variable of an active, but I'd be interested in knowing why this happens.

  4. #4
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,996
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Maybe try with Randomize(Random(999999)) instead of Randomize(timer). The expression "timer" returns the thousandths of seconds since the start of the frame, but this value can be set to anything with the action "Set timer" of the special object Timer. And this could lead to predictable results when used in conjunction with the Randomize() action.

    Or for an unknown reason the condition "On group activation" doesn't trigger correctly, thus not calling the Randomize() action. Try to use "Only one action when event loops" to see if something changes.

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Sounds like you accidentally set the random generator seed to something other than "-1" in the frame properties.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    cfullerNY's Avatar
    Join Date
    Oct 2011
    Posts
    356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Olivier View Post
    Maybe try with Randomize(Random(999999)) instead of Randomize(timer). The expression "timer" returns the thousandths of seconds since the start of the frame, but this value can be set to anything with the action "Set timer" of the special object Timer. And this could lead to predictable results when used in conjunction with the Randomize() action.
    I'll try that, thanks. If it doesn't work I'll just use a counter instead of an alterable variable, which I am 99% sure will work.

    Quote Originally Posted by MuddyMole
    Sounds like you accidentally set the random generator seed to something other than "-1" in the frame properties.
    No.

    seed.png

  7. #7
    Clickteam Clickteam
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,642
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Tey setting the random seed (randomize) to something which is constantly changing... for example:

    year+month+day+hour+minute+second+hundredths of second

    This number will constantly be increasing so the seed which is used to control where the random number generation starts from will always be different. You could also use other things such as mouse position, retrieve free memory on the PC, time since the computer was started up... anything which is not predictable basically.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    cfullerNY's Avatar
    Join Date
    Oct 2011
    Posts
    356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do I access time in expression editor? extension?

  9. #9
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    cfullerNY, for me, random has been generating the same number/set of numbers for about 3 months, regardless of what the random seed is set to, both in Clickteam Fusion and MMF2.

    http://bugbox.clickteam.com/issues/1157

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Random system in MMF is very pseudo-random generation. It got an equal chance to pick any of numbers (so random 2 gives you 50% chance on each, random 10, 10% and so forth).

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Random Numbers and expiring the result numbers.
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th April 2013, 04:11 PM
  2. Some more random Klik questions (only 7 this time)
    By oldkliker in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 17th September 2011, 01:05 AM
  3. random time and x
    By solarstorm in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 18th May 2011, 09:17 AM
  4. Random background each time game is run
    By Srandy in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 3rd August 2009, 07:05 PM
  5. Random time?
    By Spyro23 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 2nd December 2008, 08:08 AM

Posting Permissions

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